So, I have this in script 1 attached to my player object.
if(action){
actionVar = Physics2D.Linecast (sightStart.position, sightEnd.position, 1 << LayerMask.NameToLayer("Solid")).collider.gameObject;
Debug.Log ("actionVar is " + actionVar);
action = false;
}
On the npc object, I have script 2 attached.
public static bool actionRec;
void Update () {
if (actionRec){
textBox.SetActive (true);
Debug.Log("action received");
}
}
Using the GameObject stored in actionVar (because it could change based on what object the linecast hits), how can I set the actionRec variable in script 2 to true from script 1?