Best way to have a script reference the object it is on?

Is there a way to use something like ‘this’ to derive the GameObject the script is attached to?

For example:

Debug.Log(this.parent);

Thanks!

– Clint

Debug.Log(gameObject);

you guessed right:
gameObject

Here are all the functions available to every script:
http://unity3d.com/Documentation/ScriptReference/MonoBehaviour.html

Thanks Guys!

That link is ultimately what I was looking for. :wink:

Regards,

– Clint