Why doesn’t Unity use properties from C# scripts instead of fields?

There is plenty of popular opinion in the world surrounding the c# language and when developers should use a field or a property. The general consensus is that fields should remain private to a class, and, it’s what I’ve been doing for more than a decade now.

With that, a lot of younger developers, with much less experience in the language, may not even know that fields and properties are related since modern c# really has no need for backing fields in 60% or more of use cases. Instead we have the auto-properties that juniors are used to seeing:

public int MyInteger { get; set; }

Most of them do not yet have the knowledge that this is actually syntactical sugar, and that the backing fields are automatically created at compile time, effectively reducing the amount of code you have to write (cough cough, copy and paste):

private int _myInteger;
public int MyInteger {
    get { return _myInteger; }
    set { _myInteger = value; }
}

Even seeing expression bodied methods in the getter and setter is an infrequent occurrence in modern code. With that, after the many, many years that Unity has been on the market, we still don’t have natural support for using properties in the inspector for our scripts. Excluding the following work arounds, which both use field serialization:

// Pre C# 7.3 support:
(SerializeField) private int _myInteger;
public int MyInteger { get => _myInteger; set => _myInteger = value; }

// Post C# 7.3 support:
(field: SerializeField) public int MyInteger { get; set; }

Both work arounds utilize field serialization to get the exposure in the inspector for our scripts.


After all these years, what is the reason that Unity does not support using properties in the inspector instead of fields? I suspect it has something to do with one, if not more of the following:

  • Existing asset support.
  • Language support barriers (perhaps fields are easier to support?).
  • Effort/Payoff (perhaps too much effort, for too little payoff?).

NOTE: Please support your answer with official sources. Opinionated answers will not be accepted.