cocos-engine
cocos-engine copied to clipboard
所有继承内置组件的脚本在编辑器中(代码编译后)都会执行运行时代码(生命周期函数)
Cocos Creator version
3.8.6,3.8.7
System information
windows10
Issue description
import { Label } from 'cc';
import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('TestLabel')
export class TestLabel extends Label {
start() {
console.log('---------------------run in editor--')
}
update(deltaTime: number) {
}
}
自己写一个组件继承内置的UI组件,然后挂载到场景中的节点上。 每次代码编译,都会调用组件的生命周期函数start,update都会调用。 试过继承自Label,Sprite,RichText的都会调用,其他组件未尝试,但从结果推测应该内置组件都有这个问题。
Relevant error log output
贴一下调用堆栈日志,PolicyRichText为自定义脚本,继承自RichText
D:\Cocos\Creator\3.8.6\resources\app.asar\node_modules\@sentry\utils\cjs\instrument\console.js:38 ---------------------run in editor--
(anonymous) @ D:\Cocos\Creator\3.8.6\resources\app.asar\node_modules\@sentry\utils\cjs\instrument\console.js:38
start @ PolicyRichText.ts:9
eval @ D:\Cocos\Creator\3.8.6\resources\resources\3d\engine\bin\.cache\dev\editor\bundled\index.js:49048
eval @ D:\Cocos\Creator\3.8.6\resources\resources\3d\engine\bin\.cache\dev\editor\bundled\index.js:48877
invoke @ D:\Cocos\Creator\3.8.6\resources\resources\3d\engine\bin\.cache\dev\editor\bundled\index.js:48996
startPhase @ D:\Cocos\Creator\3.8.6\resources\resources\3d\engine\bin\.cache\dev\editor\bundled\index.js:49222
tick @ D:\Cocos\Creator\3.8.6\resources\resources\3d\engine\bin\.cache\dev\editor\bundled\index.js:19507
tickInEditMode @ D:\Cocos\Creator\3.8.6\resources\app.asar\builtin\scene\dist\script\3d\manager\engine\index.ccc:1
_tick @ D:\Cocos\Creator\3.8.6\resources\app.asar\builtin\scene\dist\script\3d\manager\engine\index.ccc:1
sentryWrapped @ D:\Cocos\Creator\3.8.6\resources\app.asar\node_modules\@sentry\browser\cjs\helpers.js:93
setTimeout (async)
(anonymous) @ D:\Cocos\Creator\3.8.6\resources\app.asar\node_modules\@sentry\browser\cjs\integrations\trycatch.js:108
setTimeout @ D:\Cocos\Creator\3.8.6\resources\app.asar\builtin\scene\dist\script\3d\manager\engine\index.ccc:1
_tick @ D:\Cocos\Creator\3.8.6\resources\app.asar\builtin\scene\dist\script\3d\manager\engine\index.ccc:1
sentryWrapped @ D:\Cocos\Creator\3.8.6\resources\app.asar\node_modules\@sentry\browser\cjs\helpers.js:93