浏览代码

fix endless loop

Nicholas Barlow 4 年之前
父节点
当前提交
03dddac288
共有 1 个文件被更改,包括 2 次插入1 次删除
  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;