HI,
I try to catch the value from an enum. The enum is selected in the inspector.
My code:
//The enum List
public enum EndingMode {StayOn, MouseOver, MouseExit, userCall}
public EndingMode endingMethode;
//just to test
private string zeta;
void Start(){
zeta = endingMethode.ToString ();
if(zeta ==“StayOn”)
Debug.Log (“stay”);
if(zeta == “MouseOver”)
Debug.Log (“mouseover”);
if(zeta == “MouseExit”)
Debug.Log (“mouseexit”);
if(zeta == “userCall”)
Debug.Log (“useCall”);
}
Result in console:
if i select “mouseOver” in inspector:
mouseover
UnityEngine.Debug:Log(Object)
stay
UnityEngine.Debug:Log(Object)
if i select “StayOn” in inspetor:
stay
UnityEngine.Debug:Log(Object)
stay
UnityEngine.Debug:Log(Object)
etc.
The first value of the enum (“stayOn”) is always selected at the end of the start method.
I got the same problem with a custom Inspector.
what’s wrong with my code?