Unity_HideIf icon indicating copy to clipboard operation
Unity_HideIf copied to clipboard

Doesn't work on a list/array property

Open MihailTrajkovski opened this issue 4 years ago • 1 comments

Is this an issue or by design? Because this seems like a useful case to consider. If not could you give me a tips on how to implement it? Editor scripting really is my worst skill.

More info on the issue: When I add a Hideif attribute decorator to a list/array it doesn't work. It works on all the other fields(single gameobject, int, string etc) that's how I know it's an issue connected with the hide if decorator being put on an attribute of type list or an array.

Have a nice day

MihailTrajkovski avatar Sep 27 '21 15:09 MihailTrajkovski

Hi!

Sadly, this is an issue with how drawer attributes work in Unity. When applying an attribute to arrays, the attribute drawer is always applied for each element, not the entire array.

Afaik, the only way to work around that is to make a custom editor. Things like Odin also handle it with their attributes, but they cheat and replace the entire editor for every single object, which is a bit of a pain.

Thanks for the feedback, I'd have loved to fix the issue if I could. I totally agree that it should apply to the arrays instead of the elements.

Baste-RainGames avatar Sep 27 '21 16:09 Baste-RainGames