So I'm still not completely solid on how a GameObject is composed and how to access its various parts.
I have a reference to a Collider, and need to cast it to the type of a script on the same GameObject, but I'm not sure what this would look like.
My scenario looks like this (using C#):
So how exactly do I perform that cast in the Enemy script?
asked Dec 09 '10 at 07:44 PM
Unity uses a composition model - you can access the other components from a gameobject or component using GetComponent. In your case you want something like this:
answered Dec 09 '10 at 07:48 PM