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;
}
↧