using UnityEngine; using UnityEditor; using System.Collections; [ExecuteInEditMode] public class CarDebug : MonoBehaviour { public bool showTorquePlot = true; public bool showHpPlot = true; void OnDrawGizmosSelected(){ if (enabled) { var car = GetComponent (); if (car != null) { if(car.engine != null){ Handles.BeginGUI (); Handles.EndGUI (); } } } } }