Page 1 of 1

Activate GameObjects from quest editor

Posted: Wed Sep 26, 2018 3:07 pm
by GorkaGames
Hi,

The first option in actions to activate Game Objects in the Quest / Node Editor is Activate / Desactivate by GameObject's name, I was wondering if It can be quite resource consuming if you have a open word with thousands of gameobjects. I'm currently using messages and listeners but this option is much faster to implement.

Also, if by error you have 2 gameobjects with the same name, what's going on?

Thanks,

Re: Activate GameObjects from quest editor

Posted: Wed Sep 26, 2018 4:23 pm
by Tony Li
Unity doesn't recommend searching for a GameObject by name every single frame, but it's fine as a one-time action. And in Unity 2018, they made it even faster by making transforms cache coherent.

If there are 2 GameObjects with the same name, it will use the first one it finds. It first searches active GameObjects:

Image

If it doesn't find a match among the active GameObjects, it searches all inactive GameObjects -- but the inactive GameObject's root must be active:

Image

It can be anywhere in the hierarchy as long as the root GameObject is active.