problem with get{} and set{}

I wrote some code like this and make it a prefab:

class monster:monobehaviour{

private int _health;

public int health
  get{return _health;}
  set{_health = value;}


the problem is : I can’t find a way to fill the “health” in the inspector panel of this prefab,is there a solution? (or I must erase the accessors and make _health public?)

properties aren’t serialized by Unity as well as private variables. However you can add the SerializeField attribute to your private variable and it will be serialized and show up in the inspector.

private int _health;