我剛剛看到Unity3D警報寫着使用SETACTIVE()團結
this.gameObject.active = BackdropVisible;
已經過時了。
- 警告CS0618:'UnityEngine.GameObject.active」已過時:
- `GameObject.active已經過時了。
- 使用GameObject.SetActive(),GameObject.activeSelf或GameObject.activeInHierarchy。'
昨天我只寫了,但顯然它現在是舊聞了;)
但是,設置
this.gameObject.SetActive(true);
正常工作;但
this.GameObject.SetActive(true);
沒有。區別在於大寫字母「G」 - 如錯誤信息中所用
任何人都可以清除混淆嗎? (我只是剛剛開始C#昨天)我猜小寫版本是一個變量,文檔中的是一個對象;但對於未經訓練的眼睛,他們是同一件事。顯然他們不是。
http://docs.unity3d.com/Documentation/ScriptReference/Component-gameObject.html http://docs.unity3d.com/Documentation/ScriptReference/GameObject.html – jparimaa