Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toggle Enum Flags #47

Closed
android272 opened this issue Nov 16, 2019 · 1 comment
Closed

Toggle Enum Flags #47

android272 opened this issue Nov 16, 2019 · 1 comment

Comments

@android272
Copy link

Here is another idea for a cool attribute you could add. I would like to have an enum with a whole bunch of flags I could set by toggling them. I this looks really nice when I put it in my game however I am not exactly sure how to get any useful data out of it just yet. What I want to do with this is check if an enum is toggled and then perform an action, if multiple toggles are set I would like to know that as well. But right now I am getting weird results back from this.

https://forum.unity.com/threads/enum-flags-as-toggle-buttons.298723/

Also, this has some code to handle putting buttons on new lines when they stretch past what the inspector can handle.

@Deadcows
Copy link
Owner

You want something like this maybe?
image
It's called enum flags and it is a powerful tool indeed, and default unity inspector seems fine to me, although bunch of buttons looks cool and might be useful from time to time. I actually made such thing in my custom inspectors previously so yeah, good idea for an attribute.

Enum flags is a bit tricky to use at first, I've got a tiny bit of helper functions in MyLayers class, but should add more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants