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

Answer by akasurreal

$
0
0
FYI I wrote this and it worked for my purposes, I know it may not work for all. Look up the Unity docs on Resources.FindObjectsOfTypeAll to see some potential pitfalls. public class Helpers : System.Object { public static Object Find(string name, System.Type type) { Object [] objs = Resources.FindObjectsOfTypeAll(type); foreach (Object obj in objs) { if (obj.name == name) { return obj; } } return null; } } I use it like this: UIPanel SelectSongsPanel = (UIPanel)Helpers.Find("Panel (Select Songs)", typeof(UIPanel)); SelectSongsPanel.gameObject.SetActiveRecursively(true);

Viewing all articles
Browse latest Browse all 45

Trending Articles



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