#Enum

1 messages · Page 1 of 1 (latest)

violet palm
#

hi, how can I change the option inside the enum ?
example: I have a enum {Melee, Range} I select melee and it would show a check box and when I switch to Range it will hide that check box.
how can I do that ? thank

wet verge
#

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?

violet palm
wet verge
# violet palm 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();}
}
violet palm
wet verge
#

Np

violet palm
#

can you write a clearer example ? if you don't mind

wet verge
violet palm
wet verge