I have a script on a prefab, on that script I have a variable. That variable is assigned in the update function,
public GameObject MyVar;
void Update() {
MyVar = GameObject.FindObjectWithTag("MyTag");
}
But every time I try to use this, it puts up an error: "The variable MyVar of MyScript has not been assigned.
You probably need to assign the MyVar variable of the MyScript script in the inspector."
Does anyone have a clue why this is happening?
↧