This is driving me mad as this script should work and makes sense to me, basically where the error is occurring is where I want a MonoBehaviour script to be disabled/false and the other one to be true, here is the first 26 lines of code.
#pragma strict
//Inspector variables
public var actionOnSpotted : MonoBehaviour;
public var soundOnSpotted : AudioClip;
public var actionOnLostSight : MonoBehaviour;
//Private variables
private var player : Transform;
private var enemy : Transform;
private var visualArea : boolean = true;
function Awake ()
{
player = transform;
enemy = GameObject.FindWithTag("Enemy").transform;
}
function OnEnable()
{
actionOnLostSight.enabled = true;
actionOnSpotted.enabled = false;
}
Now it is saying the error is on line 26 and saying that it’s not referencing anything, but on the Inspector there is a script attached so in theory, this code should be working fine…Or am I missing something?