I have an enum list that is going to have a different task each time I run the app. But I do not know how to set the enum list to be random. Can anyone show me how to do it? Here is my code:
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class myTestClass : MonoBehaviour {
public enum MyTasks { task1, task2, task3, task4, task5, task6 }
MyTasks currentTask = MyTasks.task1;
public Rect GUIRectWindow, r_msg;
void Awake()
{
//TODO: Initialize stuff here
}
void OnGUI()
{
// Make a background box
GUI.Box(GUIRectWindow, "");
switch (currentCubeTask)
{
case CubeTasks.task1:
drawLabel(r_msg, "This is task 1");
break;
case CubeTasks.task2:
drawLabel(r_msg, "This is task 2");
break;
case CubeTasks.task3:
drawLabel(r_msg, "This is task 3");
break;
case CubeTasks.task4:
drawLabel(r_msg, "This is task 4");
break;
case CubeTasks.task5:
drawLabel(r_msg, "This is task 5");
break;
case CubeTasks.task6:
drawLabel(r_msg, "This is task 6");
break;
}
}
}
Yeah I got that far but my code still gives me errors for trying to explicitly use the Random.Range for the enum CubeTasks. I just want to know the way to use Random.range on the enum list
– mmangual_83