Why should I use SerializeField?

后端 未结 2 1764
春和景丽
春和景丽 2020-12-09 16:14

I have just started to learn C# and Unity, and there is one thing that I can not get used to:

Why and when should I use [SerializeField]?

Is it

2条回答
  •  -上瘾入骨i
    2020-12-09 16:47

    The [SerializeField] attribute is used to mark non-public fields as serializable: so that Unity can save and load those values (all public fields are serialized by default) even though they are not public.

    That's all it does. You use it when you want that.

提交回复
热议问题