Brian
0
Q:

how to randomize ther order of elements in an array in unity

 using UnityEngine; using System.Collections;  public class DeckShuffle : MonoBehaviour {     public GameObject[] decklist;     private GameObject tempGO;          void Start () {         Shuffle();     }          public void Shuffle() {         for (int i = 0; i < decklist.Length; i++) {             int rnd = Random.Range(0, decklist.Length);             tempGO = decklist[rnd];             decklist[rnd] = decklist[i];             decklist[i] = tempGO;         }     } } 
1

New to Communities?

Join the community