I have a script that teleports an object that collides with an object tagged TeleportIn
var target : Transform;
var pathScript : Enemy_GroundUnit;
function Awake()
{
//connect to outbound teleporter
target = GameObject.FindWithTag("TeleportOut").GetComponent(Transform);
}
function Update ()
{
}
function OnTriggerEnter (col : Collider)
{
//need TeleportIn tag on TeleportIn Object
if(col.gameObject.tag == "TeleportIn")
{
this.transform.position = target.position;
pathScript.GetNewPath();
}
}
I am getting a NullReferenceException from the bottom line
pathScript.GetNewPath();
The script Enemy_GroundUnit is attatched to the same object and has a function called GetNewPath. I want to call it after the object telports. Am I calling it wrong or is this something wrong with that script?