[SOLVED] How to access meshInstances of render entity?

I have loaded a glb model via

PlayerModel = asset.resource.instantiateRenderEntity();

But I’m unable to access it’s meshInstances via




Both of them are undefined

Hi @Gamer_Wael! I guess you need to access the render component instead of the model component.


Hi Albertos, thanks for your response.

PlayerModel.render is also undefined.

I couldn’t find any documentation for instantiateRenderEntity but I saw that asset.resource is a Model so I tried accessing


Before calling instantiateRenderEntity, and it works!

1 Like

I found this:

1 Like

So after going through the documentation for RenderComponent I tried to create it as I would normally do it, but I’m running into some issues.

Right now I’m using:

app.assets.loadFromUrl('race.glb', 'container', function(err, asset) {
    PlayerModel = asset.resource.instantiateRenderEntity();

And it works fine.
But I’m trying to change it to:

app.assets.loadFromUrl('race.glb', 'container', function(err, asset) {
    PlayerModel = new pc.Entity('PlayerModel');
    PlayerModel.addComponent('render', {
        //asset: asset
        //asset: asset.resource.model
        asset: asset.resource

I’m trying to do it this way as I am familiar with this style and it makes it easier to pass attributes.
However this method isn’t working. What am I doing wrong?

see here on how to access mesh instances