Explorar o código

BaseTexture: adding uid read-only property that uniquely identifies the object

nockawa %!s(int64=9) %!d(string=hai) anos
pai
achega
d1ff91633c
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      src/Materials/Textures/babylon.baseTexture.ts

+ 8 - 0
src/Materials/Textures/babylon.baseTexture.ts

@@ -33,6 +33,13 @@
         @serialize()
         public isRenderTarget = false;
 
+        public get uid(): string {
+            if (!this._uid) {
+                this._uid = Tools.RandomId();
+            }
+            return this._uid;
+        }
+
         public toString(): string {
             return this.name;
         }
@@ -59,6 +66,7 @@
 
         private _scene: Scene;
         public _texture: WebGLTexture;
+        private _uid: string;
 
         constructor(scene: Scene) {
             this._scene = scene;