public override void OnInspectorGUI()
    {
        serializedObject.Update();

        aiController = (RCCAICarController)target;

        if (!aiController.gameObject.GetComponent <RCCCarControllerV2>().AIController)
        {
            aiController.gameObject.GetComponent <RCCCarControllerV2>().AIController = true;
        }

        if (aiController.gameObject.GetComponent <RCCCarControllerV2>().canEngineStall)
        {
            aiController.gameObject.GetComponent <RCCCarControllerV2>().canEngineStall = false;
        }

        if (!aiController.gameObject.GetComponent <RCCCarControllerV2>().autoReverse)
        {
            aiController.gameObject.GetComponent <RCCCarControllerV2>().autoReverse = true;
        }

        EditorGUILayout.Separator();
        EditorGUILayout.BeginHorizontal();
        GUILayout.Box(AIIcon, GUILayout.ExpandWidth(true));
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.Separator();

        EditorGUILayout.PropertyField(serializedObject.FindProperty("obstacleLayers"), new GUIContent("Obstacle Layers", "Obstacle Layers For Avoid Dynamic Objects."), false);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("wideRayLength"), new GUIContent("Wide Ray Distance", "Wide Rays For Avoid Dynamic Objects."), false);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("tightRayLength"), new GUIContent("Tight Ray Distance", "Tight Rays For Avoid Dynamic Objects."), false);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("sideRayLength"), new GUIContent("Side Ray Distance", "Side Rays For Avoid Dynamic Objects."), false);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("limitSpeed"), new GUIContent("Limit Speed", "Limits The Speed."), false);

        if (aiController.limitSpeed)
        {
            EditorGUILayout.Slider(serializedObject.FindProperty("maximumSpeed"), 0f, aiController.GetComponent <RCCCarControllerV2>().maxspeed);
        }

        EditorGUILayout.PropertyField(serializedObject.FindProperty("smoothedSteer"), new GUIContent("Smooth Steering", "Smooth Steering."), false);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("nextWaypointPassRadius"), new GUIContent("Next Waypoint Pass Radius", "If car gets closer then this radius, goes to next waypoint."), false);

        EditorGUILayout.Separator();
        EditorGUILayout.LabelField("Current Waypoint: ", aiController.currentWaypoint.ToString());
        EditorGUILayout.LabelField("Laps: ", aiController.lap.ToString());
        EditorGUILayout.LabelField("Total Waypoints Passed: ", aiController.totalWaypointPassed.ToString());
        EditorGUILayout.LabelField("Ignoring Waypoint Due To Unexpected Obstacle: ", aiController.ignoreWaypointNow.ToString());
        EditorGUILayout.Separator();

        serializedObject.ApplyModifiedProperties();
    }
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        aiController = (RCCAICarController)target;

        if(!aiController.gameObject.GetComponent<RCCCarControllerV2>().AIController)
            aiController.gameObject.GetComponent<RCCCarControllerV2>().AIController = true;

        if(aiController.gameObject.GetComponent<RCCCarControllerV2>().canEngineStall)
            aiController.gameObject.GetComponent<RCCCarControllerV2>().canEngineStall = false;

        if(!aiController.gameObject.GetComponent<RCCCarControllerV2>().autoReverse)
            aiController.gameObject.GetComponent<RCCCarControllerV2>().autoReverse = true;

        EditorGUILayout.Separator();
        EditorGUILayout.BeginHorizontal();
        GUILayout.Box(AIIcon, GUILayout.ExpandWidth(true));
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.Separator();

        EditorGUILayout.PropertyField(serializedObject.FindProperty("obstacleLayers"), new GUIContent("Obstacle Layers", "Obstacle Layers For Avoid Dynamic Objects."), false);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("wideRayLength"), new GUIContent("Wide Ray Distance", "Wide Rays For Avoid Dynamic Objects."), false);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("tightRayLength"), new GUIContent("Tight Ray Distance", "Tight Rays For Avoid Dynamic Objects."), false);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("sideRayLength"), new GUIContent("Side Ray Distance", "Side Rays For Avoid Dynamic Objects."), false);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("limitSpeed"), new GUIContent("Limit Speed", "Limits The Speed."), false);

        if(aiController.limitSpeed)
            EditorGUILayout.Slider(serializedObject.FindProperty("maximumSpeed"), 0f, aiController.GetComponent<RCCCarControllerV2>().maxspeed);

        EditorGUILayout.PropertyField(serializedObject.FindProperty("smoothedSteer"), new GUIContent("Smooth Steering", "Smooth Steering."), false);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("nextWaypointPassRadius"), new GUIContent("Next Waypoint Pass Radius", "If car gets closer then this radius, goes to next waypoint."), false);

        EditorGUILayout.Separator();
        EditorGUILayout.LabelField("Current Waypoint: ", aiController.currentWaypoint.ToString());
        EditorGUILayout.LabelField("Laps: ", aiController.lap.ToString());
        EditorGUILayout.LabelField("Total Waypoints Passed: ", aiController.totalWaypointPassed.ToString());
        EditorGUILayout.LabelField("Ignoring Waypoint Due To Unexpected Obstacle: ", aiController.ignoreWaypointNow.ToString());
        EditorGUILayout.Separator();

        serializedObject.ApplyModifiedProperties();
    }