[proposal] Inspector Drawer

chrisk

Active member
Hi, Justin,

I understand that that most of the UCC class has its own Inspector Drawer for customization.
Inspector customization is really nice but there is one problem.
If we were to inherit from it or extend it, we must write the customs inspector.
This can be quite tedious and error-prone and I reported that there are several UCC properties are not visible on the Inspector.
It's very easy to make the mistake.

I was thinking if there is a better way to handle and here is one solution I came up with.

Keep the current UCC inspector as is and extend the DrawField to tag the field as you draw.
After drawing all custom properties, loop through the normal public properties (visible properties to Inspector) and if it's not tagged, draw them.

This way, no properties are missed and it's up to the user whether to customize or not.

What do you think?
 
Interesting idea. The one potential issue is that there are multiple ways a field can be drawn so you could then miss tagging the field. In some situations the SerializedProperty is drawn, while in other cases DrawField is directly used. Also, in some other situations you may not want the field to be drawn at all because it's not being used.
 
I'm not an expert on Unity but I know that SerializeProperty, and HideInInspector to control drawings.
Is there a way you can get access to those attributes? I'm sure you can get attributes info though C# reflection, and depends on the custom attributes, you either draw or skip.

So the idea is to make the custom drawer to draw as is, and plus it let you draw other non-custom properties automatically.
That way, you don't miss properties and it will save having to write a custom drawer for simple stuff.

My two cents. ^^
 
Top