public override bool Release()
        {
            if (!ViveSR.EnableUnityReconstruction)
            {
                return(false);
            }
            ViveSR_RigidReconstruction.StopScanning();
            ViveSR_SceneUnderstanding.ResetParameter();
            IsThreadRunning = false;
            if (MeshDataThread != null)
            {
                MeshDataThread.Join();
                MeshDataThread.Abort();
                MeshDataThread = null;
            }
            if (IsCoroutineRunning == true)
            {
                StopCoroutine(MeshDataCoroutine);
                MeshDataCoroutine = null;
            }
            ViveSR_RigidReconstruction.ReleaseAllocOutputDataMemory();

            foreach (KeyValuePair <int, GameObject> data in ShowGameObjs)
            {
                int id = data.Key;

                MeshDataVertices[id].Clear();
                MeshDataIndices[id].Clear();
                MeshDataColors[id].Clear();
                MeshDataNormals[id].Clear();
            }
            OrderedList.Clear();
            MeshDataVertices.Clear();
            MeshDataIndices.Clear();
            MeshDataColors.Clear();
            MeshDataNormals.Clear();
            HideAllLiveMeshes();
            DestroyLiveMeshes();
            ResetParameter();
            return(true);
        }
        private void ReconstructionGUI()
        {
            GUIStyle StyleBold = new GUIStyle {
                fontStyle = FontStyle.Bold
            };

            GUILayout.Label(new GUIContent("[Runtime Command]"), StyleBold);        // start / stop
            GUILayout.Label(new GUIContent("--Start/Stop--"), StyleBold);
            if (!ViveSR_RigidReconstruction.IsScanning && !ViveSR_RigidReconstruction.IsExportingMesh)
            {
                if (GUILayout.Button("Start Reconstruction", GUILayout.ExpandWidth(false)))
                {
                    ViveSR_RigidReconstruction.StartScanning();
                }
            }
            if (ViveSR_RigidReconstruction.IsScanning && !ViveSR_RigidReconstruction.IsExportingMesh)
            {
                if (GUILayout.Button("Stop Reconstruction", GUILayout.ExpandWidth(false)))
                {
                    ViveSR_RigidReconstruction.StopScanning();
                }

                GUILayout.Label(new GUIContent("--Live Extraction--"), StyleBold);
                int curMode = (int)ViveSR_RigidReconstructionRenderer.LiveMeshDisplayMode;

                if (curMode != (int)ViveSR_RigidReconstructionRenderer.LiveMeshDisplayMode)
                {
                    ViveSR_RigidReconstructionRenderer.LiveMeshDisplayMode = (ReconstructionDisplayMode)curMode;
                }
                // adaptive tunning
                if (curMode == (int)ReconstructionDisplayMode.ADAPTIVE_MESH)
                {
                    GUILayout.Label(new GUIContent("--Live Adaptive Mesh Tuning--"), StyleBold);
                    DrawAdaptiveParamUI(ViveSR_RigidReconstruction.LiveAdaptiveMaxGridSize, ViveSR_RigidReconstruction.LiveAdaptiveMinGridSize, ViveSR_RigidReconstruction.LiveAdaptiveErrorThres);
                    ViveSR_RigidReconstruction.LiveAdaptiveMaxGridSize = adaptiveLevel[maxSelectID];
                    ViveSR_RigidReconstruction.LiveAdaptiveMinGridSize = adaptiveLevel[minSelectID];
                    ViveSR_RigidReconstruction.LiveAdaptiveErrorThres  = errorThres;
                }
            }

            // export
            if (ViveSR_RigidReconstruction.IsScanning && !ViveSR_RigidReconstruction.IsExportingMesh)
            {
                GUILayout.Label(new GUIContent("--Export--"), StyleBold);
                bool exportAdaptive = ViveSR_RigidReconstruction.ExportAdaptiveMesh;
                ViveSR_RigidReconstruction.ExportAdaptiveMesh = GUILayout.Toggle(exportAdaptive, "Export Adaptive Model");

                if (ViveSR_RigidReconstruction.ExportAdaptiveMesh)
                {
                    // live extraction mode
                    GUILayout.Label(new GUIContent("--Export Adaptive Mesh Tuning--"), StyleBold);
                    DrawAdaptiveParamUI(ViveSR_RigidReconstruction.ExportAdaptiveMaxGridSize, ViveSR_RigidReconstruction.ExportAdaptiveMinGridSize, ViveSR_RigidReconstruction.ExportAdaptiveErrorThres);
                    ViveSR_RigidReconstruction.ExportAdaptiveMaxGridSize = adaptiveLevel[maxSelectID];
                    ViveSR_RigidReconstruction.ExportAdaptiveMinGridSize = adaptiveLevel[minSelectID];
                    ViveSR_RigidReconstruction.ExportAdaptiveErrorThres  = errorThres;
                }

                if (GUILayout.Button("Start Export Model", GUILayout.ExpandWidth(false)))
                {
                    ViveSR_RigidReconstruction.ExportModel("Model");
                }
            }
        }