Makes fields marked with it uninteractable via the inspector. You can make the field only be readonly during play mode by setting OnlyWhilePlaying to true.


Simply sprinkle the [ReadOnly] attribute on a serialized field.

public class SomeClass : MonoBehaviour
    public float SomeFloat = 3;

    public string SomeString = "SomeText";

    [SerializeField, ReadOnly]
    private int _someInt = 4;

Results in:

ReadOnly Result - Not playing ReadOnly Result - While playing