lateUpdate
update 會(huì)在所有動(dòng)畫(huà)更新前執(zhí)行,但如果我們要在動(dòng)效(如動(dòng)畫(huà)、粒子、物理等)更新之后才進(jìn)行一些額外操作,或者希望在所有組件的 update 都執(zhí)行完之后才進(jìn)行其它操作,那就需要用到 lateUpdate 回調(diào)。
lateUpdate: function (dt) {
this.node.rotation = 20;
}
onEnable
當(dāng)組件的 enabled 屬性從 false 變?yōu)?true 時(shí),或者所在節(jié)點(diǎn)的 active 屬性從 false 變?yōu)?true時(shí),會(huì)激活 onEnable 回調(diào)。倘若節(jié)點(diǎn)第一次被創(chuàng)建且 enabled 為 true,則會(huì)在 onLoad 之后,start 之前被調(diào)用。
onEnable: function (dt) {
console.log('111111')
}
onDisable
當(dāng)組件的 enabled 屬性從 true 變?yōu)?false 時(shí),或者所在節(jié)點(diǎn)的 active 屬性從 true 變?yōu)?false時(shí),會(huì)激活 onDisable 回調(diào)。
onDisable: function (dt) {
console.log('111111')
}
onDestroy
當(dāng)組件或者所在節(jié)點(diǎn)調(diào)用了 destroy(),則會(huì)調(diào)用 onDestroy 回調(diào),并在當(dāng)幀結(jié)束時(shí)統(tǒng)一回收組件。
onDestroy: function (dt) {
console.log('111111')
}