Property Painter
- Create new folder and name it
Editor
. -
Inside
Editor
folder create new class,ExamplePainter.cs
public class ExamplePainter { }
-
Inherit from
PropertyPainter
class.public class ExamplePainter : PropertyPainter { }
-
Implement virtual method
OnPainterGUI
.public class ExamplePainter : PropertyPainter { public override void OnPainterGUI(Rect originalPosition, Rect painterPosition, SerializedProperty property, GUIContent label) { // Painter GUI here... } }
-
Add
PainterTarget
attribute and setExampleAttribute
as target to this view.[PainterTarget(typeof(ExampleAttribute))] public class ExamplePainter : PropertyPainter { public override void OnPainterGUI(Rect originalPosition, Rect painterPosition, SerializedProperty property, GUIContent label) { // Property GUI here... } }