You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I checked the code for these solutions. They appear to use reflection in their CustomEditor(typeof(Object)... implementations to query for all annotated methods.
The text was updated successfully, but these errors were encountered:
I wanted to avoid using non-field attributes to keep everything consistent, and I liked that the current approach gives a great possibility to place Buttons directly in the desired area. A similar case refers to Foldout(Group) functionality, this can't be implemented without treating the target object as a whole, not only single, independent properties.
I have a few ideas on how to achieve it in a pretty neat way but can't promise when this will be implemented.
True, the other solutions only support buttons at the top and bottom of the inspector, not in the middle.
When you need a "dummy" field to put decorators on, what do you use? Just an int and accept that the class will take a tiny bit more memory to store that useless int?
To be honest, I never had such a problem. If this particular component/ScriptableObject has non-serialized instance fields probably I would make something like this:
[SerializeField, Hide]
[EditorButton(nameof(MyMethod))]
private int myField;
I agree it takes a little bit of memory and in fact, it's redundant, additionally, it may be misleading for other programmers.
I think the best option is to implement a custom Editor. I know this package is created to avoid custom Editors but unfortunately, there is no clean way to do this right now.
The
EditorButton
example shows placing a button before a field by annotating the field.https://github.com/arimger/Unity-Editor-Toolbox#toolboxdecoratorattributes
Is there any way to place an attribute directly on a method? Similar to https://dbrizov.github.io/na-docs/attributes/drawer_attributes/button.html
I checked the code for these solutions. They appear to use reflection in their
CustomEditor(typeof(Object)...
implementations to query for all annotated methods.The text was updated successfully, but these errors were encountered: