[LayaAir 2.0]Resources already exist,is repeated loading 加载特效报重复加载
export default class TransformDemo{
private scene:Laya.Scene3D;
private position:Laya.Vector3 = new Laya.Vector3(0, 0, 0);
private position1:Laya.Vector3 = new Laya.Vector3(0, 0, 0);
private rotate:Laya.Vector3 = new Laya.Vector3(0, 1, 0);
private scale:Laya.Vector3 = new Laya.Vector3();
private rotate1:Laya.Vector3 = new Laya.Vector3(0, 0, 0);
private scaleDelta:number = 0;
private scaleValue:number = 0;
private layaMonkey_clone1:Laya.Sprite3D;
private layaMonkey_clone2:Laya.Sprite3D;
private layaMonkey_clone3:Laya.Sprite3D;
private clone1Transform:Laya.Transform3D;
private clone2Transform:Laya.Transform3D;
private clone3Transform:Laya.Transform3D;
private sp: Laya.Particle2D;
private sp3d: Laya.Sprite3D;
constructor(){
//初始化引擎
Laya3D.init(1134,640);
Laya.stage.scaleMode = Laya.Stage.SCALE_FULL;
Laya.stage.screenMode = Laya.Stage.SCREEN_NONE;
//显示性能面板
Laya.Stat.show();
//创建场景
this.scene = new Laya.Scene3D();
Laya.stage.addChild(this.scene);
//添加相机
var camera = new Laya.Camera(0, 0.1, 100);
this.scene.addChild(camera);
camera.transform.translate(new Laya.Vector3(0, 2, 4));
camera.transform.rotate(new Laya.Vector3( -15, 0, 0), true, false);
camera.addComponent(CameraMoveScript);
//添加光照
var directionLight= new Laya.DirectionLight();
this.scene.addChild(directionLight);
directionLight.color = new Laya.Vector3(1, 1, 1);
directionLight.transform.rotate(new Laya.Vector3( -3.14 / 3, 0, 0));
//灯光开启阴影
directionLight.shadow = true;
//可见阴影距离
directionLight.shadowDistance = 3;
//生成阴影贴图尺寸
directionLight.shadowResolution = 2048;
//生成阴影贴图数量
directionLight.shadowPSSMCount = 1;
//模糊等级,越大越高,更耗性能
directionLight.shadowPCFType = 3;
// 批量预加载资源
// Laya.loader.create([
// "res/threeDimen/staticModel/grid/plane.lh",
// "res/threeDimen/skinModel/LayaMonkey/LayaMonkey.lh",
// // "res/threeDimen/particle/RadiusMode.lh",
// "res/particles/RadiusMode.part",
// "res/threeDimen/particle/ETF_Eternal_Light.lh"
// ], Laya.Handler.create(this, this.onComplete));
//this.onComplete()
console.log("11111111111")
Laya.loader.load("res/threeDimen/particle/2d.lh", Handler.create(this, this.onAssetsLoaded), null, Loader.JSON);
}
public onAssetsLoaded(settings: ParticleSetting): void {
this.sp = new Particle2D(settings);
this.sp.emitter.start();
this.sp.play();
Laya.stage.addChild(this.sp);
this.sp.x = Laya.stage.width / 2;
this.sp.y = Laya.stage.height / 2;
} }
打印的报错:
11111111111
TransformDemo.ts:73
Resources already exist,is repeated loading: D:/myLaya/myLaya/bin/res/threeDimen/particle/2d.lh
laya.core.js:16639
[warn]Retry to load: null
laya.core.js:14865
Resources already exist,is repeated loading: D:/myLaya/myLaya/bin/res/threeDimen/particle/2d.lh
laya.core.js:16639
[error]Failed to load: null 为什么加载自己从unity导出的特效会报已经存在不能重复加载?从打印的1111来看加载方法只调用过一次,但是用官方给的特效就不会报错 particleNew.part
private scene:Laya.Scene3D;
private position:Laya.Vector3 = new Laya.Vector3(0, 0, 0);
private position1:Laya.Vector3 = new Laya.Vector3(0, 0, 0);
private rotate:Laya.Vector3 = new Laya.Vector3(0, 1, 0);
private scale:Laya.Vector3 = new Laya.Vector3();
private rotate1:Laya.Vector3 = new Laya.Vector3(0, 0, 0);
private scaleDelta:number = 0;
private scaleValue:number = 0;
private layaMonkey_clone1:Laya.Sprite3D;
private layaMonkey_clone2:Laya.Sprite3D;
private layaMonkey_clone3:Laya.Sprite3D;
private clone1Transform:Laya.Transform3D;
private clone2Transform:Laya.Transform3D;
private clone3Transform:Laya.Transform3D;
private sp: Laya.Particle2D;
private sp3d: Laya.Sprite3D;
constructor(){
//初始化引擎
Laya3D.init(1134,640);
Laya.stage.scaleMode = Laya.Stage.SCALE_FULL;
Laya.stage.screenMode = Laya.Stage.SCREEN_NONE;
//显示性能面板
Laya.Stat.show();
//创建场景
this.scene = new Laya.Scene3D();
Laya.stage.addChild(this.scene);
//添加相机
var camera = new Laya.Camera(0, 0.1, 100);
this.scene.addChild(camera);
camera.transform.translate(new Laya.Vector3(0, 2, 4));
camera.transform.rotate(new Laya.Vector3( -15, 0, 0), true, false);
camera.addComponent(CameraMoveScript);
//添加光照
var directionLight= new Laya.DirectionLight();
this.scene.addChild(directionLight);
directionLight.color = new Laya.Vector3(1, 1, 1);
directionLight.transform.rotate(new Laya.Vector3( -3.14 / 3, 0, 0));
//灯光开启阴影
directionLight.shadow = true;
//可见阴影距离
directionLight.shadowDistance = 3;
//生成阴影贴图尺寸
directionLight.shadowResolution = 2048;
//生成阴影贴图数量
directionLight.shadowPSSMCount = 1;
//模糊等级,越大越高,更耗性能
directionLight.shadowPCFType = 3;
// 批量预加载资源
// Laya.loader.create([
// "res/threeDimen/staticModel/grid/plane.lh",
// "res/threeDimen/skinModel/LayaMonkey/LayaMonkey.lh",
// // "res/threeDimen/particle/RadiusMode.lh",
// "res/particles/RadiusMode.part",
// "res/threeDimen/particle/ETF_Eternal_Light.lh"
// ], Laya.Handler.create(this, this.onComplete));
//this.onComplete()
console.log("11111111111")
Laya.loader.load("res/threeDimen/particle/2d.lh", Handler.create(this, this.onAssetsLoaded), null, Loader.JSON);
}
public onAssetsLoaded(settings: ParticleSetting): void {
this.sp = new Particle2D(settings);
this.sp.emitter.start();
this.sp.play();
Laya.stage.addChild(this.sp);
this.sp.x = Laya.stage.width / 2;
this.sp.y = Laya.stage.height / 2;
} }
打印的报错:
11111111111
TransformDemo.ts:73
Resources already exist,is repeated loading: D:/myLaya/myLaya/bin/res/threeDimen/particle/2d.lh
laya.core.js:16639
[warn]Retry to load: null
laya.core.js:14865
Resources already exist,is repeated loading: D:/myLaya/myLaya/bin/res/threeDimen/particle/2d.lh
laya.core.js:16639
[error]Failed to load: null 为什么加载自己从unity导出的特效会报已经存在不能重复加载?从打印的1111来看加载方法只调用过一次,但是用官方给的特效就不会报错 particleNew.part
要回复问题请先登录
2 个回复
bpmf_d
赞同来自:
138*****224
赞同来自: