How to find GameObject in script?
How i can find Raw Image called "Cursor" in script?
Canvas -> EmptyObject -> Cursor
Answer by JedBeryll · Oct 03, 2016 at 05:48 AM
If this is the only Raw Image, use GetComponentInChildren<RawImage>()
. Otherwise you have a number of options, you could get all of the rawimages with GetComponentsInChildren<RawImage>()
and search trough the returned array, or transform.Find("EmptyObject").Find("Cursor")
for example.
Your answer
Follow this Question
Related Questions
How to find all GameObjects in Hierarchy by name and put them in an Array[] ? (C#) 1 Answer
Way of Finding/accessing a variable from another script though another variable? 1 Answer
What to use instead of GameObject.Find and GetComponent 2 Answers
How can we be notified the moment an object is instanced in the scene ? 3 Answers
GameObject.Find not working? 1 Answer