#Enum
1 messages · Page 1 of 1 (latest)
I dont think there is enough context with your question - what are you trying to do, and where are you testing this? Is this something in the inspector on a script, or the Canvas dropdown or somewhere else in code? Are you trying to initialize this value? And how/where are you trying to change it?
I have rewrite the question, hope you can understand
Ah, so you want to show or hide an object based on the value of a enum? Something like this?
public SomeEnum something = SomeEnum.Opt1;
public enum SomeEnum {Opt1, Opt2}
void SomeFunc()
{
if (something == SomeEnum.Opt1) {DoSomething();}
else if(something == SomeEnum.Opt2) {DoSomethingElse();}
}
oh, yes, right, that.... thanks
Np
can you write a clearer example ? if you don't mind
What do you not understand in the above example?
well, yes I can but still don't clear the problem...
so, in the "DoSomething();" I could add some like public bool, int, ects ?
DoSomething() and DoSomethingElse() is just whatever logic your trying to do when that statement is true, be it changing the toggle state of a UI objectt, or hiding a game object in the scene, or showing certain text or setting some health to a specific value or whatever your trying to do when the enum is "Opt1" or "Opt2" specifically