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?