Q:

Setting initial value in Custom inspector

I would like to set the initial value to the Level from the inspector. I'm using the following Model class.
public class Sample : MonoBehaviour
{
    public float Level { get; set; }
 

}

In my editor class, this is how I'm accessing the model.
    sampleScript.Level = EditorGUILayout.FloatField(sampleScript.Level);

How do I set the initial value of the level to 1 in the inspector?

A:

public class Sample : MonoBehaviour
{
    [SerializeField]
    private float level = 1; // initial value

    public float Level { get => level; set => level = value; }
}

In Unity you should expose the private field as [SerializeField]. This way it will be visible in the Inspector. You can also use public fields, but I'd recommend you to always use property with a serialized private backing field.
EDIT:
You can't expose properties in the Inspector. The properties are just methods to the Inspector. You can find or make your own custom editor script to serialize auto-properties, but using full properties with a serialized backking field is the best IMO (and really simple).

