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

Answer by Neonalig

$
0
0
GameObject.Find() only returns active objects. for unactive objects, use this: Resources.FindObjectsOfTypeAll(typeof(YOURTYPEHERE)); so, lets say you want to find all of a certain tag, that aren't active: foreach (GameObject obj in Resources.FindObjectsOfTypeAll(typeof(GameObject))) { if (obj.tag == "Player" && !obj.activeSelf) { //any if statement here print(obj.name + " is inactive, and has a tag of 'Player'."); } } I have confirmed this works in 5.6+, and 2017.1+

Viewing all articles
Browse latest Browse all 45

Trending Articles



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