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 = Sirenix.Utilities.Editor.EditorIcons.OdinInspectorLogo")]
[OnInspectorGUI("DrawPreview", append: true)]
public Texture2D Texture;

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

    GUILayout.BeginVertical(GUI.skin.box);
    GUILayout.Label(this.Texture);
    GUILayout.EndVertical();
}

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