Render Asset is not showing in Runtime

Please help asset render problem.

  1. Load GLB in Editor
  • It’s Fine. No problem.
  1. Load Only “Render Asset”

  • In Runtime, No problem. Very good Rendering.
  1. Load Full GLB
  • It’s not showing in runtime.
  • GLB file include only render file.
  • In code, adds the material in the AssetRegistry.
  • When the render entity is created, it is saved to the Map and returned when requested.
        DownloadGlb = function(name, type, parameter, callback) {
  , type, function (err, asset) {
                const assetName = name.slice(name.lastIndexOf('/') + 1, -4);

                const mm ="MatchMaterials", "json");
                const materials = mm.resources[0].GLB[assetName]?.materials;

                const entity = asset.resource.instantiateRenderEntity(parameter);
       = assetName;
                if(materials !== undefined) {
                    var renders = entity.findComponents("render");
                    for(var i = 0; i < renders.length; ++i) {
                        for(var j = 0; j < renders[i].meshInstances.length; ++j) {
                            const findAsset =[j], "material");
                            renders[i].meshInstances[j].material = findAsset.resources[0];

                mapGLB.set(name, entity);
                var cloneEntity = entity.clone();

Request Render Entity

PostInitMesh.prototype.postInitialize = function() {
    let outRenderEntity = GlbManager.getInstance().Get('https://***.kr/fetch/M_1.glb');
    console.log("Render Asset Id: ", outRenderEntity.children[0].render.asset);

So what I want to do is, I want to just load the modeling glb, then I want to create the entity and add the material.

Can you share an example project of the issue please and steps to reproduce the issue?

I send DM. Because I have a personal download address.

What are the steps to reproduce the issue?

From the looks of the project, you have several issues:

  1. Script DownloadAssets.js is not being used as it’s not attached to an entity.
  2. You are calling change scene in the callback of DownloadAssets.js so it get stuck in an infinite loop
  3. It looks like you are not waiting for the GLBs to be downloaded fully before creating them in the scene.

I’ve made the following changes:

  1. Have the postInit* scripts listen for an app event that will be fired when all the assets have loaded on initialize
  2. Removed the changeScene call in DownloadAssets.js and have it fire an event when the external assets have loaded.

Here is a fork with the URL paths to your server removed:

1 Like

Thank you @yaustar
But, I don’t solve this issue.

issue step:

  1. Launch to “LoadingScene” Scene.
  2. Download GLB files, if finished download files, change to the “NPC” scene.
  3. Change scene, PlayerEntity in Hierarchy execute “postInitMesh” script.
  4. This script gets RenderEntity from the map container in the GlbManager(singleton).
  5. But I Don’t see RenderEntity. If successful, It must be visible where the particles are played.

I revised the code as you advised.
Still same issue occurr.

I found some clues.

Original Code:

    const onDownloadAssetDone = function() {
        let outRenderEntity = GlbManager.getInstance().Get('https://***/fetch/M_1.glb');
  • Get Entity from the map container in the GlbManager script. (singleton)
  • Result.

Changed Code:

var self = this;'https://***/fetch/M_1.glb', 'container', function (err, asset) {
        var i = 0;
        var allMeshInstances = [];
        var matchMaterials = [];                

        const mm ="MatchMaterials", "json");
        const materials = mm.resources[0].GLB.M_1.materials;

        const entity = asset.resource.instantiateRenderEntity();

        if(materials !== undefined) 
            console.log('materials s');
            for(let m = 0; m < materials.length; ++m) 
                const findAsset =[m], "material");

            var renders = entity.findComponents("render");
            for (i=0; i < renders.length; ++i) 
                var meshInstances = renders[i].meshInstances;
                for (var j = 0; j < meshInstances.length; ++j) 

            for ( i = 0; i < allMeshInstances.length; ++i) 
                var mesh = allMeshInstances[i];
                mesh.material = matchMaterials[i];
  • When loading from the script itself, outputs normally.
  • Result.

Does it damage the entity if I load what’s stored in the container?

Sorry, I don’t really understand your problem and the code you have in your project is a little convoluted to follow.

Ah, I see how it works now. I didn’t realise you had a preloader scene

In which case, the main issue is that the GLBs you load from DownloadAssets, get placed on the Character render layer. The camera and light in NPC scene haven’t been assigned that layer to render.

After I’ve added the Character layer to the light and camera, it looks like this:

I’ve updated the forked project with these changes:

1 Like

OMG LOL, I made such a stupid mistake…
It works fine. The code must have been hard to read, but