public override void OnInspectorGUI() { base.OnInspectorGUI(); var Target = target as MeshInspector; EditorGUILayout.LabelField("Mesh Info:"); EditorGUILayout.HelpBox(Target.GetMeshInfo(), MessageType.None); Mesh mesh = Target.Mesh; GUI.changed = false; int maxTriangleIndex = mesh ? Target.Mesh.triangles.Length / 3 - 1 : 0; GUI.enabled = mesh; Target.inspectTriangle = EditorGUILayout.Toggle("Inspect triangle", Target.inspectTriangle); Target.triangleIndex = EditorGUILayout.IntSlider($"Triangle index ({Target.triangleIndex}/{maxTriangleIndex}):", Target.triangleIndex, 0, maxTriangleIndex); if (GUILayout.Button("Next")) { Target.TriangleIndexNext(); } if (GUILayout.Button("Previous")) { Target.TriangleIndexPrev(); } string triangleInfo; if (Target.inspectTriangle && Target.TriangleIndexIsValid()) { var(p0, p1, p2) = Target.GetTriangle(Target.triangleIndex); triangleInfo = $"0: {p0}\n1: {p1}\n2: {p2}\nArea: {Geom.TriangleArea(p0, p1, p2)}"; } else { triangleInfo = "0 ...\n1 ...\n2 ...\nArea: ..."; } EditorGUILayout.LabelField("Triangle Info:"); EditorGUILayout.HelpBox(triangleInfo, MessageType.None); GUI.enabled = true; }