- Home /
Using GameObject.Find
How would I go about using GameObject.Find(""); in C# I've tried doing it the same way but its just not working.
I want to get the code to look for an object that is in my project view even if its a child to another object.
Can anyone help me?
Answer by KJones · Feb 01, 2012 at 11:45 PM
You should be able to use this line to access another active GameObject within your scene view, even if it's the child of another GameObject:
GameObject.Find("Object Name Here")
If you're trying to access something in your project but outside of the current scene, you'll have to assign it via an inspector reference or load it from a Resource folder using Resources.Load("Prefab Name").
Your answer
Follow this Question
Related Questions
GameObject.Find closest ?? 2 Answers
Creating a single-line function for GameObject.Find and GetComponent (for multiple components) 3 Answers
how do I get reference to a parent or a child? 2 Answers
How to find all gameObjects in a bounding area? 2 Answers
Can't find gameobjects being spawned getting a nullreferenceexception 1 Answer