gameobject = self?

as a newbie convert from other game engines into Unity… I’m having a bit of trouble with this…

Basically, I have a waypoint game object that sets the player’s.curTarget as the waypoint in the function Start()

but I’m not sure how to say…

 player.curTarget = self;

because self doesn’t work in Unity…

here’s the code I’m using

(This declaration is in the Player’s CharacterMovement.js script.)

var curTarget : GameObject;

(This function is in the Waypoint’s start function)

function Start()
{
	var player : GameObject = GameObject.Find("player");

	if(player.GetComponent(CharacterMovement).initialTargetID == waypointID)
	{
		player.GetComponent(CharacterMovement).curTarget = ???;
            //or would it be 
            //player.curTarget = ???;
	}
};

how would I go about doing this?

You can use this instead of self

I’m also a noob at Unity so I don’t know if this will help in your case or not… but I was trying to make an bullet destroy itself after a few seconds, and I ended up with:
Destroy(gameObject, 1);
(gameObject, not GameObject)
So I guess (Unity) gameObject = (JavaScript) self.
Hope that helps! :smiley: