Find object in current scene

Silly question, but how do you find an object in the current scene?

app.root.findByName("entity name")

If you haven’t its worth having a read through the user manual on http://developer.playcanvas.com/

2 Likes

Thank you so much. I have been looking through the API for this and I just couldn’t find it. What part of the manual refers to the app class? I am a current Unity 3D developer, but Play Canvas is so sweet.

I see this is quite an old reply and it doesn’t seem to work anymore.
I get various errors like
Uncaught ReferenceError: app is not defined

Is there an other way to do something like

var myEntity = app.root.findByName(“entity name”) ?

With new scripts is this.app.root.findByName(“entityname”)

1 Like

Ohhh yes I think I got it !! Thanks again Ayrin !

1 Like