소스 검색

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;
 
         /**
+         * 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;