为什么场景中的对象为空?

Why is the object on the scene null?

我在场景中有一个名为“Diam”的对象。为什么第一个 if 被触发而不是 else。毕竟迪亚姆在台上,不应该等于零吧? P.S。好的,让它为空。问:那我们检查了什么?

public class CircleCode : MonoBehaviour{
    public GameObject Diam;

    void Start() {
        if (Diam == null){
            Debug.Log("Diam == null");
        } else {
            Debug.Log("Diam is not null");
        }
    }
}

It's my objects

你在 Inspector 中分​​配了 Diam 了吗?

Select CircleCode 并在检查器的 Diam 字段上拖动直径 game-object。