Browse Source

Emitter: Fix creation of empty emitter

trethaller 2 years ago
parent
commit
109c91d9a8
1 changed files with 8 additions and 4 deletions
  1. 8 4
      hrt/prefab/fx/Emitter.hx

+ 8 - 4
hrt/prefab/fx/Emitter.hx

@@ -574,11 +574,15 @@ class EmitterObject extends h3d.scene.Object {
 		totalBurstCount = 0;
 		listHead = null;
 
-		for(i in 0...randomValues.length)
-			randomValues[i] = random.srand();
+		if(randomValues != null) {
+			for(i in 0...randomValues.length)
+				randomValues[i] = random.srand();
+		}
 
-		for(p in particles)
-			p.idx = ParticleInstance.REMOVED_IDX;
+		if(particles != null) {
+			for(p in particles)
+				p.idx = ParticleInstance.REMOVED_IDX;
+		}
 
 		if(subEmitters != null) {
 			for( s in subEmitters )