MonoBehaviour Properties not saving their values from Editor

When I change a value, it stays, but as soon as I hit play it resets to 0/default.

public class SomeComponent : MonoBehaviour
{
    public int SomeValue { get; set; }
}

Custom Editor:

[CustomEditor(typeof(SomeComponent))]
public class SomeComponentEditor : Editor
{
    private SomeComponent Target { get { return (SomeComponent)this.target; } }

    public override void OnInspectorGUI()
    {
        EditorGUIUtility.LookLikeInspector();

        EditorGUILayout.BeginVertical();

        Target.SomeValue = EditorGUILayout.IntField("Some Value", Target.SomeValue);

        EditorGUILayout.EndVertical();
    }
}

Yes this is all a ruse, but the purpose was to note it down here for others.

What you have to do is not use auto-properties. You have to apply the [SerializeField] attribute to your backing field, so the following, modified version of SomeComponent works:

public class SomeComponent : MonoBehaviour
{
    [SerializeField]
    private int _someValue;

    public int SomeValue
    {
        get { return _someValue; }
        set
        {
            if (_someValue == value) return;

            _someValue = value;
        }
    }
}

It's a shame, because auto-properties are so neat. Unity should definitely add [SerializeProperty], knowing that the compiler should make its own backing field.

I'm having this problem, but I don't understand how this fixes it. I've been using the custom ExposeProperty attribute provided here. I could have sworn it worked perfectly in the past, but at some point it broke and I can't figure out how to fix it.

The problem with the proposed solution is that when you made changes to _someValue from the editor, it doesn't call the setter, and so you never run the additional processing your setter might do.