Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

my c# variable can't be assigned

$
0
0
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?

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>