#if UNITY_EDITOR using UnityEngine; using UnityEditor; [CustomEditor(typeof(ProjectileSpawner))] public class TowerEditor : Editor { private float arcDist = 1f; public void OnSceneGUI() { var tower = (serializedObject.targetObject as Component).gameObject.GetComponent(); // Draw horizontal angle Handles.color = Color.red; float angleX = tower.HorizontalRotationMinMax.y - tower.HorizontalRotationMinMax.x; float vX = (Mathf.PI - tower.HorizontalRotation * Mathf.Deg2Rad) / 2f; Vector3 fromX = Quaternion.AngleAxis(tower.HorizontalRotationMinMax.x, tower.transform.up) * tower.transform.right; Handles.DrawWireArc(tower.transform.position, tower.transform.up, fromX, angleX, arcDist, 5); // Draw vertical angle Handles.color = Color.green; float angleY = tower.VerticalRotationMinMax.y - tower.VerticalRotationMinMax.x; float vY = (Mathf.PI - tower.VerticalRotation * Mathf.Deg2Rad) / 2f; Vector3 fromY = Quaternion.AngleAxis(tower.VerticalRotationMinMax.x, tower.transform.right) * tower.transform.up; Handles.DrawWireArc(tower.transform.position, tower.transform.right, fromY, angleY, arcDist, 5); } } #endif