I have a prefab that I am using with a script attached to it. Here is the code:
using UnityEngine;
using System.Collections;
public class bagDetect : MonoBehaviour {
public GameObject okToShoot;
public bool canScore = true;
void Start () {
okToShoot.GetComponent<ID355> ().okToScore = true;
}
void Update () {
canScore = true;
}
}
the problem is i cannot seem to attach the reference to it. It will not let me drag and drop or assign the variable. This is the error i get when i run the game. Any ideas on what i am doing wrong???
UnassignedReferenceException: The variable okToShoot of bagDetect has not been assigned.
You probably need to assign the okToShoot variable of the bagDetect script in the inspector.
UnityEngine.GameObject.GetComponent[ID355] ()
bagDetect.Start () (at Assets/bagDetect.cs:8)