Quantcast
Viewing latest article 16
Browse Latest Browse All 30

Choose a Random Tag

Basically, I have five GameObjects each with a tag that is a number between 1 and 5. I'm trying to set the tagNumber integer = a random integer between 1 and 5. Then, I want it to set the target variable equel to a GameObject with the randomly selected tag. Any help is much appreciated. Transform target; public int tagNumber; void Awake () { tagNumber = Random.Range (1, 5); target = GameObject.FindWithTag (tagNumber).transform; }

Viewing latest article 16
Browse Latest Browse All 30

Trending Articles



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