Hi, I am trying to find the frst instance of a component in my scene. I know it exists because I created it in the editor and it is never destroyed but my code is returning null. The script is attached to my root node.
I tried:
this.my_script=this.app.root.findComponent("myScript");
if(this.my_script==null)
{
console.error("myScript not found!!"); //this prints
}
…and this…
this.my_script=this.app.root.getChildren()[0].findComponent("myScript");
Whats going on? Why cant it find the component?
Cheers