|
@@ -661,6 +661,10 @@ export class Material implements IAnimatable {
|
|
constructor(name: string, scene: Scene, doNotAdd?: boolean) {
|
|
constructor(name: string, scene: Scene, doNotAdd?: boolean) {
|
|
this.name = name;
|
|
this.name = name;
|
|
this.id = name || Tools.RandomId();
|
|
this.id = name || Tools.RandomId();
|
|
|
|
+ let idSubscript = 0;
|
|
|
|
+ while (scene.getMaterialByID(this.id) != null) {
|
|
|
|
+ this.id = name + "_" + idSubscript;
|
|
|
|
+ }
|
|
|
|
|
|
this._scene = scene || EngineStore.LastCreatedScene;
|
|
this._scene = scene || EngineStore.LastCreatedScene;
|
|
this.uniqueId = this._scene.getUniqueId();
|
|
this.uniqueId = this._scene.getUniqueId();
|