Browse Source

adding a disposal check

rickfromwork 4 năm trước cách đây
mục cha
commit
cbce658c54
1 tập tin đã thay đổi với 6 bổ sung1 xóa
  1. 6 1
      gui/src/3D/controls/touchButton3D.ts

+ 6 - 1
gui/src/3D/controls/touchButton3D.ts

@@ -120,7 +120,12 @@ export class TouchButton3D extends Button3D {
                 }
 
                 // Debug line mesh
-                debugLineMesh.dispose();
+                if (debugLineMesh)
+                {
+                    // remove the previous line before drawing the new one
+                    debugLineMesh.dispose();
+                }
+                
                 debugLineMesh = Mesh.CreateLines("debug_line", [
                     _this._collisionMesh.getAbsolutePosition(),
                     indexMesh.getAbsolutePosition()