timo-sisus / Power-Inspector

Report bugs and offer improvement ideas for Power Inspector.
http://u3d.as/1sNc
8 stars 0 forks source link

Custom property drawers aren't used on member fields of an abstract type #18

Closed DarrenRuaneKaizen closed 4 years ago

DarrenRuaneKaizen commented 4 years ago

I have a custom PropertyDrawer for drawing the fields of a ScriptableObject. It works great with PowerInspector for the most part but it does not get used when a declared field type is abstract (even though the injected type is a derived, non-abstract type).

To clarify on that, here's what I've got in my project:

In doing this, I would expect my custom property drawer to be used, but instead the AbstractDrawer is used.

Removing the abstract qualifier from the base type solves the problem but I'd like to refrain from doing this as it introduces a code-smell into my project.

Similarly, changing the declared type on the MonoBehaviour to one of the derived types solves this too, but of course that defeats the entire purpose of what I'm trying to achieve (a strategy pattern-like approach using ScriptableObject).

I understand that this may not be an "issue" so-to-speak but if there is a more elegant way for me to get my custom drawer used on a declared abstract type that'd be fantastic.

Thanks for your help.

timo-sisus commented 4 years ago

Thanks for the report. This will be fixed in update 1.3.4.