protected virtual void OnSceneGUI() { EasyWallCollider easyWallCollider = (EasyWallCollider)target; if (!easyWallCollider.CanBeEdited() || !easyWallCollider.isActiveAndEnabled) { return; } var corners = easyWallCollider.corners; if (corners.Count < 3) { return; } for (int i = 0; i < corners.Count + easyWallCollider.loopInt(); i++) { Vector3 from = corners[i].position; Vector3 to = corners[(i + 1) % corners.Count].position; DrawButton(easyWallCollider, from, to, corners[i], corners[i].GetSiblingIndex() + 1); } if (!easyWallCollider.loop) { DrawButton(easyWallCollider, corners[0].position, corners[0].position + (corners[0].position - corners[1].position), corners[0], corners[0].GetSiblingIndex()); int lastIx = corners.Count - 1; DrawButton(easyWallCollider, corners[lastIx].position, corners[lastIx].position + (corners[lastIx].position - corners[lastIx - 1].position), corners[lastIx], corners[lastIx].GetSiblingIndex() + 1); } }
public override void OnInspectorGUI() { EasyWallCollider easyWallCollider = (EasyWallCollider)target; if (easyWallCollider.CanBeEdited()) { base.OnInspectorGUI(); } else { GUILayout.Label("Editing polygon colliders is not allowed on Prefabs. Open the prefab and edit there instead"); } }
public override void OnInspectorGUI() { EasyWallCollider easyWallCollider = (EasyWallCollider)target; if (easyWallCollider.CanBeEdited()) { base.OnInspectorGUI(); if (easyWallCollider.DEBUG) { EditorGUILayout.HelpBox("Use debug mode at your own risk. We cannot guarantee everything to stay error-free in debug mode, as this allows you to break things. It's only intended for investigation and debugging, if you know what you're doing.", MessageType.Warning); } } else { GUILayout.Label("Editing polygon colliders is not allowed on Prefabs. Open the prefab and edit there instead"); } }