What's the point of all this?
The InspectorTypeEnforcerAttribute
and the InspectorTypeEnforcerPropertyDrawer
classes above will help inform you that a Monobehaviour does not implement a desired interface.
How to install
- InspectorTypeEnforcerAttribute.cs - Put this file in your 'Scripts' folder
- InspectorTypeEnforcerPropertyDrawer.cs - Put this in your 'Editor' folder
How to Use
Throw the [InspectorTypeEnforcer(typeof(YOUR_TYPE_HERE))]
attribute on any Serialized property of a MonoBehaviour/ScriptableObject. See the 'TestUsageBehaviour.cs' below for an example.
The Result
Dragging a MonoBehaviour that does not implement the desired interface will turn red when dragged on to the property donned with the attribute.