I keep running into this issue with Mono that my Enum is the wrong type and is expected to be a float?
I'm getting error **CS1061- Type 'float' does not contain a definition for 'smooth'**.... blah blah...
I get this statement if **I try to use my enum in a switch statement** and I haven't a clue why. My other switch statement works fine but this one does not...
I've set up my enum like so outside my class.
**public enum hoverSpeed {smooth, eightBit, appear}**
I get a public reference in my class.
**public hoverSpeed floatSpeed;**
I then call this function that contains the switch statement ->
**speedType();**
Here is the function.
public void speedType()
{
switch(floatSpeed)
{
case hoverSpeed.smooth:
CompareTime.Value = 0.1f;
break;
case hoverSpeed.eightBit:
CompareTime.Value = 0.5f;
break;
case hoverSpeed.appear:
CompareTime.Value = 5f;
break;
default:
CompareTime.Value = 0.1f;
break;
}
}
and then I get the type error...
The **error is gone** if I use the global settings:
case global::hoverSpeed.smooth
but I want to know what I did wrong. And why I can't use this enum like my other enum in my script? I've used multiple enums in a script before, the enums don't share any similar names or variables. Why am I getting a type issue?
↧