Syntax: this

this is a special reserved word that can be used to refer to the object that the script is contained within. Normally objects must be referred to explicitly by name (e.g. Object1.GetPosition() ) or by referenece to another named object (eg. Object2.GetParent().GetName() ).

The primary advantage of the this syntax is to be able to copy a script into any object and have it work without having to modify the script to refer to a specific object. This is particularly useful when cloning objects with scripts attached to them, as the script will still function correctly even though the object name has changed.

image\Script_Button.jpgExamples