Browse Source

Merge pull request #4359 from kcoley/uniqueIDForMaterial

Add unique id to material
David Catuhe 7 years ago
parent
commit
3ec62eb7c6
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/Materials/babylon.material.ts

+ 7 - 0
src/Materials/babylon.material.ts

@@ -395,6 +395,12 @@
         public id: string;
 
         /**
+         * Gets or sets the unique id of the material
+         */
+        @serialize()
+        public uniqueId: number;
+
+        /**
          * The name of the material
          */
         @serialize()
@@ -776,6 +782,7 @@
             this.id = name || Tools.RandomId();
 
             this._scene = scene || Engine.LastCreatedScene;
+            this.uniqueId = this._scene.getUniqueId();
 
             if (this._scene.useRightHandedSystem) {
                 this.sideOrientation = Material.ClockWiseSideOrientation;