Quantcast
Channel: Answers for "GameObject.Find() work on inactive objects"
Viewing all articles
Browse latest Browse all 45

Answer by Bampf

$
0
0
Tranquility's [link he posted in the comments][1] contains an easy solution. Just keep an array of the disabled objects that you might want to find again. In the given code the author was bringing back all the disabled objects at once, whereas you just need to search the array for the desired object and return it. To put a nice wrapper around it, you could call this array something like SceneTrash, and when you want to deactivate an object call your own PutInTrash method to deactivate an object and store it in the trash can. Then your code can rummaged through the trashed objects whenever it needs to. [1]: http://answers.unity3d.com/questions/14178/cannot-toggle-active-on-gameobjects-that-are-inactive

Viewing all articles
Browse latest Browse all 45

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>