public void OnDrawGizmos() { if (m_meshSimplifyRoot != null) { if (m_meshSimplifyRoot.m_bExpandRelevanceSpheres == false) { return; } } else { if (m_bExpandRelevanceSpheres == false) { return; } } Gizmos.color = Color.red; RelevanceSphere[] aRelevanceSpheres = m_meshSimplifyRoot != null ? m_meshSimplifyRoot.m_aRelevanceSpheres : m_aRelevanceSpheres; if (aRelevanceSpheres == null) { return; } bool bDrawVertices = false; for (int i = 0; i < UnityEditor.Selection.gameObjects.Length; i++) { if (((UnityEditor.Selection.gameObjects[i] == this.gameObject) && m_meshSimplifyRoot == null) || ((m_meshSimplifyRoot != null) && (UnityEditor.Selection.gameObjects[i] == m_meshSimplifyRoot.gameObject))) { bDrawVertices = true; } } if (bDrawVertices == false) { return; } Vector3[] aVerticesWorld = Simplifier.GetWorldVertices(this.gameObject); if (aVerticesWorld == null) { return; } Matrix4x4[] aSphereMatrices = new Matrix4x4[aRelevanceSpheres.Length]; for (int nSphere = 0; nSphere < aRelevanceSpheres.Length; nSphere++) { aSphereMatrices[nSphere] = Matrix4x4.TRS(aRelevanceSpheres[nSphere].m_v3Position, Quaternion.Euler(aRelevanceSpheres[nSphere].m_v3Rotation), aRelevanceSpheres[nSphere].m_v3Scale).inverse; } for (int nVertex = 0; nVertex < aVerticesWorld.Length; nVertex++) { for (int nSphere = 0; nSphere < aRelevanceSpheres.Length; nSphere++) { if (aRelevanceSpheres[nSphere].m_bExpanded) { Vector3 v3VertexSphereLocal = aSphereMatrices[nSphere].MultiplyPoint(aVerticesWorld[nVertex]); if (v3VertexSphereLocal.magnitude <= 0.5) { Gizmos.DrawCube(aVerticesWorld[nVertex], Vector3.one * UnityEditor.HandleUtility.GetHandleSize(aVerticesWorld[nVertex]) * 0.05f); break; } } } } }