Property Validator
- Create new folder and name it
Editor
. -
Inside
Editor
folder create new class,ExampleValidator.cs
public class ExampleValidator { }
-
Inherit from
PropertyValidator
class.public class ExampleValidator : PropertyValidator { }
-
Implement abstract method
Validate
.public class ExampleValidator : PropertyValidator { public override void Validate(SerializedProperty property) { // Property validation here... } }
-
Add
ValidatorTarget
attribute and setExampleAttribute
as target to this view.[ValidatorTarget(typeof(ExampleAttribute))] public class ExampleValidator : PropertyValidator { public override void Validate(SerializedProperty property) { // Property validation here... } }