瀏覽代碼

Emitter: fix null access when spawning emitter outside of scene

trethaller 6 年之前
父節點
當前提交
5f778d5dd4
共有 1 個文件被更改,包括 6 次插入1 次删除
  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.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(propName == null || ["emitShape", "emitAngle", "emitRad1", "emitRad2"].indexOf(propName) >= 0)