- Home /
Question by
jayesh4520 · Jan 28, 2018 at 08:25 AM ·
randomswap
prefab are repeating in random swap
my code so far using System.Collections; using System.Collections.Generic; using UnityEngine;
public class evve : MonoBehaviour { public GameObject[] blocks; public int Xposition; public int counter;
void Start(){
Xposition = 0;
for (counter = 0; counter < 5; counter++) {
Instantiate (blocks[(UnityEngine.Random.Range (0,blocks.Length))],new
Vector2(Xposition,0),transform.rotation); Xposition += 5; }
} }
my prefabs are repeating and i dont want that btw this is code for random swap and spawn
Comment