Hi there.
In UnityScript
it works
gameObject.Find("HOGEOBJECT");
but, in C# it doesn’t work
gameObject is static valiable?
Find function is static function.
Could you tell me why C# can’t work gameObject.Find?
Hi there.
In UnityScript
it works
gameObject.Find("HOGEOBJECT");
but, in C# it doesn’t work
gameObject is static valiable?
Find function is static function.
Could you tell me why C# can’t work gameObject.Find?
Try GameObject.Find instead gameObject.Find
Also, when you write it doesnt work, do you receive an error in the unity console window?
Hi Marrrk Marrrk
Thanks for replying.
I know GameObject.Find works in C#.
but, what I want to know is " Why gameObject.Find can’t work in C#"?
If you want a child of the Gameobject, you can use transform.Find(“”);
Edit: Ok, you probably did want GameObject.Find(). It’s weird that gameObject.Find() does work in Javascript, because gameObject refers to the GO your script is attached to, that’s why I thought you might want transform.Find(). Someone smarter has to explain why gameObject.Find works in Javascript.