This is a part of my script:
void Start() {
GameObject[] gems = GameObject.FindGameObjectsWithTag ("blueGem");
foreach (GameObject gem in gems) {
Vector3 pos = gem.transform.position;
pos.y = Random.Range(collectibleMin, collectibleMax);
gem.transform.position = pos;
}
}
How the problem is that in the array it is currently only storing the Blue Gems.
I have multiple kinds of gems, like GreenGems, RedGems and DiamondGems.
(with tags attached to them ‘greenGem’, ‘redGem’, and ‘diamondGem’)
So now in the game only the position of the Blue Gems are randomized.
How can I fix this? … How can I store all the game in the ‘gems’ array.
Thanks in advance – Nathan.