import { _decorator, assetManager, Component, instantiate, Node, Prefab, UITransform } from 'cc'; import { StartGameUINode } from './StartGameUINode'; const { ccclass, property } = _decorator; @ccclass('UIRoot') export class UIRoot extends Component { init(){ const startGameUINode = new StartGameUINode(); startGameUINode.addComponent( UITransform).setContentSize(1067,600); this.node.addChild(startGameUINode); console.log(this.node.parent.children); console.log('StartUINode'); } start() { this.node.addComponent( UITransform ).setContentSize(1067,600); this.init(); } update(deltaTime: number) { } }