Cocos Creator 3.6.2 父子节点 update 执行顺序详解
在 Cocos Creator 3.6.2 中,父节点的 update 方法会在所有子节点的 update 方法之前执行。具体执行顺序如下:
- 先执行父节点的 update 方法;
- 然后按照节点树的层次结构,从上到下依次执行子节点的 update 方法;
- 最后执行所有组件的 update 方法。
需要注意的是,如果子节点的 active 属性为 false,则不会执行该节点的 update 方法。此外,在 Cocos Creator 3.6.2 中,节点的 update 方法默认是关闭的,需要手动开启才能执行。可以通过勾选节点的'启用自动更新'选项来开启节点的 update 方法。
原文地址: https://www.cveoy.top/t/topic/nvaa 著作权归作者所有。请勿转载和采集!