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.

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

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);
}