Hi guys i need u’re help i have this code.
using UnityEngine;
using System.Collections;
public class Randomm : MonoBehaviour {
public GameObject[ ] Item;
public Transform[ ] Spawn = new Transform[3];
void Start () {
Negro ();
}
void Update () {
}
void Negro () {
int IndiceObjetos = Random.Range (0, 5);
int Indicepawnbs = Random.Range (0, 3);
Instantiate (Item[Random.Range(0,5)], Spawn[Random.Range(0, 3)].position, Spawn[Random.Range(0, 3)].rotation);
Instantiate (Item[IndiceObjetos], Spawn[Indicepawnbs].position, Spawn[Indicepawnbs].rotation);
}
}
i have this to spawn 5 prefabs and i want to spawn 1 pref in 1 spaw point and the second in other spawn point sometime the 2 objects spawn in the same spawn point, how can i fix it? And how can i do to take only object 1 and in the second random exclude object 1 and the didn’t have 2 identical objects in the scene?
Thx.