- Creator 版本:2.4.5
在脚本里创建节点,log里边看节点的属性都配置成功了但是就不显示,不知道为啥,下边是代码
creatBg() {
let node = new cc.Node(‘bg’);
let widget = node.addComponent(cc.Widget);
let width = this.node.width;
let height = this.node.height;
widget.isAlignTop = true;
widget.isAlignLeft = true;
widget.top = 0;
widget.left = 0;
node.setAnchorPoint(0, 1);
node.color = new cc.Color(230, 206, 172);
node.width = width;
node.height = height;
node.parent = this.node;
},
在onload里边调用了这个方法,但是没有显示