private void OnDestroy() { if (m_editor != null && m_editor.Object != null) { m_editor.Object.Started -= OnObjectStarted; m_editor.Selection.SelectionChanged -= OnSelectionChanged; foreach (ExposeToEditor obj in m_editor.Object.Get(false)) { PBMesh pbMesh = obj.GetComponent <PBMesh>(); if (pbMesh != null) { WireframeMesh[] wireframeMesh = pbMesh.GetComponentsInChildren <WireframeMesh>(true); for (int i = 0; i < wireframeMesh.Length; ++i) { WireframeMesh wireframe = wireframeMesh[i]; if (!wireframe.IsIndividual) { Destroy(wireframe.gameObject); break; } } } } } if (m_window != null) { ResetCullingMask(m_window); } }
protected virtual void TryCreateWireframe(ExposeToEditor obj) { PBMesh pbMesh = obj.GetComponent <PBMesh>(); if (pbMesh != null && !pbMesh.GetComponentsInChildren <WireframeMesh>().Any(w => !w.IsIndividual)) { CreateWireframeMesh(pbMesh); } }
protected virtual void TryDestroyWireframe(ExposeToEditor obj) { PBMesh pbMesh = obj.GetComponent <PBMesh>(); if (pbMesh != null) { WireframeMesh[] wireframeMesh = pbMesh.GetComponentsInChildren <WireframeMesh>(true); for (int i = 0; i < wireframeMesh.Length; ++i) { WireframeMesh wireframe = wireframeMesh[i]; if (!wireframe.IsIndividual) { Destroy(wireframe.gameObject); break; } } } }