arimger/Unity-Editor-Toolbox

Some Attributes are not Co-Existing.

Zenodeon opened this issue · 6 comments

I noticed some Attributes are not Co-Existing like for eg
[Disable] and [ShowIf(...)]
which ever is declared first will override the next one.

So if [Disable] is declared first and then [ShowIf(...)]. The variable is always shown even if showif is false but only in readonly state.
and
[ShowIf(...)] with [Disable]. The variable is shown based on showif condition but not in real only state.

You can have only one conditional attribute on a property, this is by design.

Any Particular reason for this?
I would like them to co exist.

Every conditional drawer returns in what state the property should be: hidden, visible, or disabled. Supporting multiple conditional drawers, in this case, would require additional logic to resolve situations like what to do if one drawer wants to hide property and the next wants to disable it.

What exactly do you want to achieve with [Disable, ShowIf]? Maybe DisableIf would be better? If you want to have something really custom you can easily create your own conditional attribute & drawer, here is an example:
https://github.com/arimger/Unity-Editor-Toolbox/blob/master/Assets/Editor%20Toolbox/HOWTO.md

I require this in one of our custom tools, where I am displaying fields based on the enum.

So basically based on the enum, i am showing the field in read only state.

It works out of the box with naughty attributes, but as this plugin has more useful features, i decided to migrate to this plugin.

Will see if can make the custom attributes for this.

Oh, there is an attribute called ShowDisabledIf, this is what i was looking for. Lollll

You should mention this in the read me file.

I wanted to keep README.md as an example and general overview source and the Wiki as a "documentation" but I don't have time to make it properly. Anyway, thanks, I will add information about all conditional drawers to the README.