[LayaAir 2.0]编辑模式下定义的变量如何在代码模式下获取啊

编辑模式下定义的变量如何在代码模式下获取啊

QQ图片20190306161755.png

 
已邀请:

达尔文

赞同来自:

// 找到它的父对象,比如它的父对象名字是scene
let scene = Laya.stage.getChildByName('scene');
// 直接父对象里就包含了一个和你定义的var属性同名的属性(指针)了
let buttonStart = scene.buttonStart;
// 当然你也可以通过name去找,指针指向的都是同一个对象
let buttonStart_getByName = scene.getChildByName('buttonStart');
// 输出:true
console.log(buttonStart === buttonStart_getByName);

要回复问题请先

商务合作
商务合作