Cocos TS脚本boxCollider报错显示his component has not been call onLoad yet

  • Creator 版本: 3.4.1

  • 目标平台: Chorme浏览器

  • 重现方式:

  • 首个报错: [Physics]: This component has not been call onLoad yet, please make sure the node has been added to the scene.

该错误实在TS脚本中产生的,以下是相关代码:
@property({
type: Node,
})
public Group: Node = null!;

public onEnable() {
this.mapManager.resetMap();
this.carManager.reset(this.mapManager.currPath);
const collider = this.Group.getComponent(BoxCollider)!;
collider.setGroup(Constants.CarGroup.NORMAL);
collider.setMask(-1);
}
我在onEnable中想处理从组件中获取的group的BoxCollider,但在浏览器中运行报错:
[Physics]: This component has not been call onLoad yet, please make sure the node has been added to the scene.
我确定在编辑器中添加了group,group中也含有BoxCollider。
该如何解决该问题?

你好,我也遇到同样的问题,您解决了吗?