I’ve been running into this issue for a while now, I need a way to use an enum name as a variable e.g.,
(I think I got that right, I’ve been up all night)
public class Example : MonoBehaviour
{
while (i < 100)
{
newValue = enumValues.i;
i += 25;
}
}
public enum enumValues : int
{
25 = 5000,
50 = 250000,
75 = 2,
}
Of course that can’t be done but…
Is there anyway to pull off this type of iteration without using cases?
Is there a way to not hardcode an Enum into place? e.g.,
(and I’m assuming the following doesn’t work but I haven’t tried it lately)
public class Example : MonoBehaviour
{
desiredString = "derp";
newValue = enumValues.desiredString;
}
public enum enumValues : int
{
derp = 5000,
hurp = 250000,
baderp = 2,
}