unity random flag enum code example
Example: unity get random enum value
public enum CardSuit { Spades, Hearts, Diamonds, Clubs } void Start () { cardSuit = (CardSuit)Random.Range(0, 3); // or // cardSuit = (CardSuit)Enum.ToObject(typeof(CardSuit) , Random.Range(0, 3)); }