ソースを参照

Merge pull request #4359 from kcoley/uniqueIDForMaterial

Add unique id to material
David Catuhe 7 年 前
コミット
3ec62eb7c6
1 ファイル変更7 行追加0 行削除
  1. 7 0
      src/Materials/babylon.material.ts

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

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