We know script file can be treated as class,the class name is myscript.
myscript derive from MonoBehaviour. MonoBehaviour has a member variable named gameObject.
So we can use gameObject directly in unityscript and unityscript are case sensitive.
As we known,GameObject have a static function named Find,
but it isn’t a instance function named Find.
My question is why we can use gameObject.Find.
Maybe someone know this,could you tell me.
If you can find answer from unity official website,it is better.
gameObject refers to the object. GameObject refers to the class.
Instance functions associated with an object usually have to do with that specific object – finding its components, for example.
Static functions aren’t associated with any particular object, but rather with the class as a whole. With the “idea” of a GameObject. Finding a GameObject in the scene is associated with the GameObject class. It’s a static function.
gameObject.Find("Foo"); //no such function
GameObject.Find("Foo"); //calls the existing static function