Open JefferiesTube opened 2 years ago
What do you mean by two editors? You mean PropertyA and PropertyC should have the exact same value?
No, but if possible I'd like to execute the editor code per group only once. To be more specific: I would like to draw a button for each group that opens a popup menu (comparable to the way the EventTrigger editor from the Unity UI works)
There is no easy way to make your own group type. If it is a very specific editor - one off thing - I think writing it as usual is the way. You could use MarkupGUI class to create MarkupAttribute style grouping in this custom inspector.
There is also a way to add custom things to the inspector before, after or instead of any property https://github.com/gasgiant/Markup-Attributes#custom-marked-up-inspectors
You could do something like this
[TitleGroup("Category A")]
public SomeClass PropertyA
public SomeClass PropertyC
[TitleGroup("Category B")]
public SomeClass PropertyB
and then make a custom MarkedUpEditor that would manually add buttons after, say, properties C and B. But, obviously, you would have to add a button to each group you create manually.
But this would not prevent the properties from being drawn in the editor. If I could add something to the wishlist for this library it would be make it possible to add custom attributes. I assume that this is rather difficult, but it would allow to write really clean things that (so far) only Odin is capable of (and Odin cannot be included in custom AssetStore products)
Could you, please, elaborate on what you mean by the custom attribute here? Or maybe point to Odin documentation for an example.
Do you mean things like a TitleGroup modification that adds a button below it or something more complex?
I wanted to use MarkupAttributes to allow me to overcome a limitation of PropertyDrawers. I have multiple properties like this:
I want to divide them into several groups like this:
I want to create a custom drawer that creates a single(!) editor for each group (so in this example even though I have 3 properties, I end up with 2 editors).
Is this possible with MarkupAttributes? It looks comparable to the TitleGroup-Attribute. Is there any information how to extend your system with custom attributes?