Show a warning in the inspector

I’d like to show a warning in the inspector like the Point Effector 2D does if there is no 2D Collider present on the same game object:


How to accomplish that?

You have to implement a custom inspector for your class and when you want to show such a warning you can use “EditorGUILayout.HelpBox” inside OnInspectorGUI. Something like that:

EditorGUILayout.HelpBox("Some warning text", MessageType.Warning);