Hello, I'm quite new to unity coding side and i'm trying to learn how i would select random 5 images(Cards) from a array and render them on the screen. Can someone give me some help to get started? This is what i have so far. I don't quite understand how i can make random.range use the array. Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; public class DrawCards : MonoBehaviour { public Sprite[] CardList; // Use this for initialization } // Update is called once per frame void Update () { } void OnGUI(){ } }
I found out how Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; public class DrawCards : MonoBehaviour { public Sprite[] CardList; public SpriteRenderer CardRenderer; // Use this for initialization void Start () { CardRenderer.sprite = CardList [Random.Range (0, CardList.Length)]; } // Update is called once per frame void Update () { } void OnGUI(){ } }