On Value Changed Attribute

OnValueChanged works on properties and fields, and calls the specified function whenever the value has been changed via the inspector.

[OnValueChanged("CreateMaterial")]
public Shader Shader;

[ReadOnly, InlineEditor(InlineEditorModes.LargePreview)]
public Material Material;

private void CreateMaterial()
{
    if (this.Material != null)
    {
        Material.DestroyImmediate(this.Material);
    }

    if (this.Shader != null)
    {
        this.Material = new Material(this.Shader);
    }
}

[EnumPaging, OnValueChanged("SetCurrentTool")]
[InfoBox("Changing this property will change the current selected tool in the Unity editor.")]
public UnityEditor.Tool sceneTool;

private void SetCurrentTool()
{
    UnityEditor.Tools.current = this.sceneTool;
}