Unity nullable integer作为检查器字段

时间:2018-04-30 18:04:27

标签: c# unity3d

我为我的检查员创建了一个Serializable课程。

[Serializable]
public class CellType
{
    [SerializeField]
    public int? Cost; // This does not appear in the inspector

    [SerializeField]
    public Color MaterialColor;
}

可以为空的字段Cost未出现在检查器中。我通过创建SerializeField

来使用此类
[SerializeField]
private CellType[] types;

如果字段Cost是默认的int,则会出现该字段。可行的解决办法吗?

0 个答案:

没有答案