Hi,
I am trying to write a really simple script which is supposed to render a random sprite. The first part of the code was working, I was able to assign different sprites through the inspector. Than came the hard part for me. No matter how I try, it always gives me Error CS0201. I know I probably doing some basic stuff wrong here but as a rookie I can’t figure out what. Please help me
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RandomDice : MonoBehaviour {
[System.Serializable]
public class SpriteList
{
public Sprite[] sprites;
}
public Sprite[] SpriteLists;
void Start ()
{
SpriteRenderer sr = GameObject.GetComponent<SpriteRenderer>();
sr.sprite = SpriteList[Random.Range(0, 5)];
}
}