i have a little issue....i want to spawn Quads in my Scene and they all should have either red or green as Material. But the Random.Range function will only int´s, how could i solve it ??
void SpawningSquadsRnd()
{
rndColor[0] = Color.red;
rndColor[1] = Color.green;
for (int i = 0; i < 5; i++)
{
GameObject quad = Instantiate(squadPrefab, new Vector3(Random.Range(- 23, 23), 1.5f, Random.Range(-23, 23)), Quaternion.identity);
int index = Random.Range(0, rndColor.Length);
quad.gameObject.GetComponent<Renderer>().material.color = //Random.Range(0, rndColor.Length);
}
}
Aucun commentaire:
Enregistrer un commentaire