Hi, I have instantiated a template at runtime and I am trying to find the children of that instance (by name) )and tween them, but I just keep getting errors that they are undefined:
This part instantiates the entity and tries to assign its child entities (called Explode_Layer_0,Explode_Layer_1 etc)
if( modelAsset && modelAsset.loaded)
{
var instance = modelAsset.resource.instantiate();
this.model_position=this.app.root.findByName("Model Position");
//this.app.root.addChild(instance);
this.model_position.addChild(instance);
//get cutaway layers. These models should now exist in the scene
this.explodeLayer_0= this.app.root.findByName("Explode_Layer_0");
this.explodeLayer_1= this.app.root.findByName("Explode_Layer_1");
this.explodeLayer_2= this.app.root.findByName("Explode_Layer_2");
this.explodeLayer_3= this.app.root.findByName("Explode_Layer_3");
this.explodeLayer_4= this.app.root.findByName("Explode_Layer_4");
this.explodeLayer_5= this.app.root.findByName("Explode_Layer_5");
}
But when I try to tween later like this they come back as undefined(Cannot read property ‘tween’ of undefined):
Yeah, I already have tweening on other entities before this that works fine. It seems to be a problem with accessing the entity, for example even this code comes up wit the same error:
Okay I sent an invite. Sorry for the delay but I was putting out a fire (quite literally in my house! - all safe now). To see the error just run it and choose Purple> Purple Original (You’ll see what I mean.)
The script with the issue is called model-screen-manager.js
Yes!. Apologies I was looking at the wrong mattress all along! If you look at the Purple Hybrid 4 it works fine. Thanks for your help and apologies for being stupid with this one.