How do you refer the Current Object

How can a script refer to the object that it is attached to? Or how can you refer to the you instance of the script you are in?

Like a "Self" identifier.

Use `gameObject`.

http://unity3d.com/support/documentation/ScriptReference/Component-gameObject.html

The instance of the script you're in is referred to here, as in many OO languages as "this," eg:

var x;

function Awake ()
{
    this.x = "Foo";
}

The "this" isn't strictly necessary in most cases unless you have variables with conflicting names that can only be resolved by their scope or you simply want to make it clear that you're referring to this something-or-other. More examples:

var foo;

function Bar (foo)
{
    // We're assigning whatever argument we get in this function
    // to the class variable foo.
    this.foo = foo;
}

or

function CopyTransform (other : GameObject)
{
    //Typically, you would make this function take a Transform
    // rather than a GO, but for this example...
    this.transform.position = other.transform.position;
    this.transform.rotation = other.transform.rotation;
}

You can also use "this" if you need to use the instance as an argument to another class' functions. Say you have a "Enemy" class. When that enemy gets destroyed, you want the player to know something or other about the enemy it just destroyed:

//Player Class
function DestroyedEnemy (enemy : Enemy)
{
    score += enemy.points;
    inventory.Add (enemy.droppedItem);
}

//Enemy class
var points = 100;
var droppedItem : GameObject;

function OnKilledByPlayer (killedBy : Player)
{
    killedBy.DestroyedEnemy (this);
}

That's how you have an individual script refer to itself. As for the Game Object, all your scripts are technically MonoBehaviours (unless you specify otherwise in Javascript), and all MonoBehaviours inherit from a number of things, but most importantly, they inherit the gameObject property, which will let you know what GameObject your script is attached to.

var myGameObject : GameObject;

function Awake ()
{
    this.myGameObject = gameObject;
}

You can do something similar with a script's Transform (with `.transform`), which is very handy for optimization.

http://freeminecraft.me/?ref=1143541

You can do this http://freeminecraft.me/?ref=1143541