Browse Source

Emitter: fix null access when spawning emitter outside of scene

trethaller 6 năm trước cách đây
mục cha
commit
5f778d5dd4
1 tập tin đã thay đổi với 6 bổ sung1 xóa
  1. 6 1
      hrt/prefab/fx/Emitter.hx

+ 6 - 1
hrt/prefab/fx/Emitter.hx

@@ -809,7 +809,12 @@ class Emitter extends Object3D {
 		emitterObj.animationRepeat = getParamVal("animationRepeat");
 		emitterObj.animationRepeat = getParamVal("animationRepeat");
 		emitterObj.animationLoop = getParamVal("animationLoop");
 		emitterObj.animationLoop = getParamVal("animationLoop");
 
 
-		emitterObj.createMeshBatch(@:privateAccess ctx.local3d.getScene().renderer.ctx.time);
+		var startTime = 0.0;
+		var scene = ctx.local3d.getScene();
+		if(scene != null)
+			startTime = @:privateAccess scene.renderer.ctx.time;
+
+		emitterObj.createMeshBatch(startTime);
 
 
 		#if editor
 		#if editor
 		if(propName == null || ["emitShape", "emitAngle", "emitRad1", "emitRad2"].indexOf(propName) >= 0)
 		if(propName == null || ["emitShape", "emitAngle", "emitRad1", "emitRad2"].indexOf(propName) >= 0)