using System;
using UnityEngine;
using Wave.Native;

namespace ScenePerceptionToolkit
{
    public class GeneratedPlane : IDisposable
    {
        public WVR_Uuid uuid;
        public WVR_ScenePlane plane;
        public GameObject go;

        public void DestroyGameObject()
        {
            if (go == null) return;
            
            var meshFilter = go.GetComponent<MeshFilter>();
            if (meshFilter != null && meshFilter.sharedMesh)
            {
                UnityEngine.Object.Destroy(meshFilter.sharedMesh); 
            }

            UnityEngine.Object.Destroy(go);
            go = null;
        }
        

        public void Dispose()
        {
            DestroyGameObject();
        }
    }
}
