I have a auto-property that is serialized on the Inspector and i need to rename it without loosing the serialized value, normally i would use the [FormerlySerializedAs(previousName)] attribute for this, the problem is that it's not working with auto-properties, does anybody have any insight on this?
My code:
public class Test : MonoBehaviour
{
[field: SerializeField]
[field: FormerlySerializedAs("previousName")]
public Transform FieldIWantToRemainSerialized { get; private set; }
}
Little late, but maybe someone will find that usefull, you need to use this:
[field: FormerlySerializedAs("<previousName>k__BackingField")]