[]meshRender修改材质问题
warehouse1 = Laya.Sprite3D.load("model/build/warehouse1/warehouse1.lh");换了一个模型就不行了,模型文件如下
scene.addChild(warehouse1);
warehouse1.transform.rotate(new Laya.Vector3(0, 90, 0), false, false);
warehouse1.transform.translate(new Laya.Vector3(0,0,0),false);
warehouseMeshSprite3D1= warehouse1.getChildAt(0).getChildByName("Mesh1");
var material = warehouseMeshSprite3D1.meshRender.material;
material.albedo = new Laya.Vector4(1,0,0,1);
会提示报错信息:
TypeError: Cannot read property 'meshRender' of null
at onCompleteWarehouse1 (file:///E:/LayaWorkspace/javaScriptLaya/src/warehouse.js:74:43)
at Handler.__proto.run (file:///E:/LayaWorkspace/javaScriptLaya/bin/libs/laya.core.js:697:26)
at ResInfo.onLoaded (file:///E:/LayaWorkspace/javaScriptLaya/bin/libs/laya.core.js:12723:28)
at EventHandler.__proto.runWith (file:///E:/LayaWorkspace/javaScriptLaya/bin/libs/laya.core.js:713:27)
at ResInfo.__proto.event (file:///E:/LayaWorkspace/javaScriptLaya/bin/libs/laya.core.js:483:28)
at LoaderManager.__proto._endLoad (file:///E:/LayaWorkspace/javaScriptLaya/bin/libs/laya.core.js:12841:11)
at Loader.onLoaded (file:///E:/LayaWorkspace/javaScriptLaya/bin/libs/laya.core.js:12818:10)
at EventHandler.__proto.runWith (file:///E:/LayaWorkspace/javaScriptLaya/bin/libs/laya.core.js:713:27)
at Loader.__proto.event (file:///E:/LayaWorkspace/javaScriptLaya/bin/libs/laya.core.js:483:28)
at Loader.__proto.endLoad (file:///E:/LayaWorkspace/javaScriptLaya/bin/libs/laya.core.js:12470:8)
如果是只有一个lm文件的模型就没有问题,这种两个lm文件组成的就出问题了,试过其他同类型的模型,也都是同样的问题
没有找到相关结果
已邀请:
要回复问题请先登录
3 个回复
Aar0n
赞同来自:
bing8310124
赞同来自:
Aar0n
赞同来自: