Layabox 预制体prefab使用

//腊鸭官方api不详细系列之ui预制体

// 创建预制体文件,随便拖一个场景中的预制体到 Assets的任意文件夹中,要规范的话则放在Prefab中

// 上一步操作完后就可以在文件夹中看到.prefab文件了

// 双击该.prefab文件如下图所示,然后按F12键 保存导出

 // 如下图,可以看到bin文件目录下的prefab文件夹离会多一个和上面prefab文件同名的.json文件

 

// 然后添加预制体,操作完成

Laya.loader.create("prefab/changeView.json", Laya.Handler.create(this, function(){
            this.cellView = Laya.loader.getRes("prefab/changeView.json");
            this.cell = new Laya.View();
            this.cell.createView(cellView);
            this.addChild(this.cell);
        }));

猜你喜欢

转载自www.cnblogs.com/huojiaoqingchun0123/p/11763748.html
今日推荐