Hi, i was implementing a class and the this keyword is not working as i expected.
I had this class:
class Unit
{}
that has this constructor:
function Unit (go : GameObject)
{
go.GetComponent (UnitNeutral).SetInfo (this);
}
but the this keyword is always null, i checked with this:
if ( this == null )
{
Debug.Log ("Null");
}
and it always printed null!
What i want is the game object to had a reference to the Unit class that is the one that controls that game object so i can cycle from the game object to the unit class to the game object.
Im doing something wrong ?
Is the this keyword not valid in that class ?
thanks
.ORG