On Inspector GUIAttribute

OnInspectorGUI is used on any property, and will call the specified function whenever the inspector code is running. Use this to create custom inspector GUI for an object.

[OnInspectorInit("@Texture = EditorIcons.OdinInspectorLogo")]
[OnInspectorGUI("DrawPreview", append: true)]
public Texture2D Texture;

private void DrawPreview()
    if (this.Texture == null) return;


private void OnInspectorGUI()
    UnityEditor.EditorGUILayout.HelpBox("OnInspectorGUI can also be used on both methods and properties", UnityEditor.MessageType.Info);