Browse Source

fix endless loop

Nicholas Barlow 4 years ago
parent
commit
03dddac288
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/Materials/material.ts

+ 2 - 1
src/Materials/material.ts

@@ -663,7 +663,8 @@ export class Material implements IAnimatable {
         this.id = name || Tools.RandomId();
         let idSubscript = 0;
         while (scene.getMaterialByID(this.id) != null) {
-            this.id = name + "_" + idSubscript;
+            idSubscript++;
+            this.id = name + " " + idSubscript;
         }
 
         this._scene = scene || EngineStore.LastCreatedScene;