- UID
- 2227797
- 熱心
- 58 值
- 嘉獎
- 0 次
- 違規
- 0 次
- 在線時間
- 12 小時
- 經驗
- 30 點
- 積分
- 100
- 精華
- 0
- 最後登錄
- 2015-11-7
- 閱讀權限
- 20
- 註冊時間
- 2015-4-13
- 論壇幣
- 30 幣
- 聯合幣
- 87 枚
- 幸運鑽
- 0 顆
- 招待卷
- 0 點
|
RemoveListener should always be called on messages when loading a new level. Otherwise many MissingReferenceExceptions will be thrown, when invoking messages on destroyed objects.For example:1. We registered a "speed changed" message in a Level1 scene. Afterwards the scene has been destroyed, but the "speed changed" message is still pointing to the OnSpeedChanged message handler in the destroyed class. 2. We loaded Level2 and registered another "speed changed" message, but the previous reference to the destroyed object hasn't been removed. We'll get a MissingReferenceException, because by invoking the "speed changed" message, the messaging system will first invoke the OnSpeedChanged handler of the destroyed object.
|
|