Exemple #1
0
        /// <summary>
        /// Called when the object should be drawn to the inspector.
        /// </summary>
        /// <param name="target">The object that is being drawn.</param>
        /// <param name="parent">The Unity Object that the object belongs to.</param>
        public override void OnInspectorGUI(object target, Object parent)
        {
            InspectorUtility.DrawField(target, "m_LookDirectionDistance");
            InspectorUtility.DrawField(target, "m_ForwardAxis");
            InspectorUtility.DrawField(target, "m_LookOffset");
            InspectorUtility.DrawField(target, "m_LookOffsetSmoothing");
            InspectorUtility.DrawField(target, "m_PositionSmoothing");
            InspectorUtility.DrawField(target, "m_ObstructionPositionSmoothing");
            InspectorUtility.DrawField(target, "m_UpdateCharacterRotation");
            InspectorUtility.DrawFieldSlider(target, "m_AlignToGravityRotationSpeed", 0, 1);
            InspectorUtility.DrawFieldSlider(target, "m_FieldOfView", 1, 179);
            InspectorUtility.DrawFieldSlider(target, "m_FieldOfViewDamping", 0, 5);
            InspectorUtility.DrawField(target, "m_CollisionRadius");
            InspectorUtility.DrawField(target, "m_CollisionAnchorOffset");
            if (Shared.Editor.Inspectors.Utility.InspectorUtility.Foldout(target, "Primary Spring"))
            {
                EditorGUI.indentLevel++;
                InspectorUtility.DrawSpring(target, "Position Spring", "m_PositionSpring");
                InspectorUtility.DrawSpring(target, "Rotation Spring", "m_RotationSpring");
                EditorGUI.indentLevel--;
            }

            if (Shared.Editor.Inspectors.Utility.InspectorUtility.Foldout(target, "Secondary Spring"))
            {
                EditorGUI.indentLevel++;
                InspectorUtility.DrawSpring(target, "Position Spring", "m_SecondaryPositionSpring");
                InspectorUtility.DrawSpring(target, "Rotation Spring", "m_SecondaryRotationSpring");
                EditorGUI.indentLevel--;
            }

            if (Shared.Editor.Inspectors.Utility.InspectorUtility.Foldout(target, "Step Zoom"))
            {
                EditorGUI.indentLevel++;
                InspectorUtility.DrawField(target, "m_StepZoomInputName");
                InspectorUtility.DrawField(target, "m_StepZoomSensitivity");
                InspectorUtility.DrawField(target, "m_MinStepZoom");
                InspectorUtility.DrawField(target, "m_MaxStepZoom");
                EditorGUI.indentLevel--;
            }

            if (Shared.Editor.Inspectors.Utility.InspectorUtility.Foldout(target, "Limits"))
            {
                EditorGUI.indentLevel++;
                OnDrawLimits(target);
                EditorGUI.indentLevel--;
            }
        }
        /// <summary>
        /// Called when the object should be drawn to the inspector.
        /// </summary>
        /// <param name="target">The object that is being drawn.</param>
        /// <param name="parent">The Unity Object that the object belongs to.</param>
        public override void OnInspectorGUI(object target, Object parent)
        {
            // Draw the fields related to rendering.
            if (InspectorUtility.Foldout(target, "Rendering"))
            {
                EditorGUI.indentLevel++;
                InspectorUtility.DrawField(target, "m_LookDirectionDistance");
                var lookOffsetValue = InspectorUtility.GetFieldValue <Vector3>(target, "m_LookOffset");
                var lookOffset      = EditorGUILayout.Vector3Field(new GUIContent(InspectorUtility.SplitCamelCase("m_LookOffset"), InspectorUtility.GetFieldTooltip(target, "m_LookOffset")), lookOffsetValue);
                // Set the property if the game is playing so the camera will update.
                if (lookOffsetValue != lookOffset)
                {
                    (target as FirstPerson).LookOffset = lookOffset;
                    InspectorUtility.SetFieldValue(target, "m_LookOffset", lookOffset);
                }
                InspectorUtility.DrawField(target, "m_LookDownOffset");
                InspectorUtility.DrawField(target, "m_CullingMask");
                InspectorUtility.DrawFieldSlider(target, "m_FieldOfView", 1, 179);
                InspectorUtility.DrawFieldSlider(target, "m_FieldOfViewDamping", 0, 5);
#if ULTIMATE_CHARACTER_CONTROLLER_LWRP || ULTIMATE_CHARACTER_CONTROLLER_UNIVERSALRP
                var prevRenderType = InspectorUtility.GetFieldValue <FirstPerson.ObjectOverlayRenderType>(target, "m_OverlayRenderType");
                InspectorUtility.DrawField(target, "m_OverlayRenderType");
                var renderType = InspectorUtility.GetFieldValue <FirstPerson.ObjectOverlayRenderType>(target, "m_OverlayRenderType");
                // Ensure the render type has been switched for all first person view types.
                if (prevRenderType != renderType)
                {
                    if (renderType == FirstPerson.ObjectOverlayRenderType.SecondCamera)
                    {
                        UltimateCharacterController.Utility.Builders.ViewTypeBuilder.AddFirstPersonCamera(parent as CameraController, target as FirstPerson);
                    }
                    else if (prevRenderType == FirstPerson.ObjectOverlayRenderType.SecondCamera)
                    {
                        var firstPersonCamera = InspectorUtility.GetFieldValue <UnityEngine.Camera>(target, "m_FirstPersonCamera");
                        if (firstPersonCamera != null)
                        {
                            if (PrefabUtility.IsPartOfPrefabInstance(firstPersonCamera.gameObject))
                            {
                                PrefabUtility.UnpackPrefabInstance(PrefabUtility.GetOutermostPrefabInstanceRoot(firstPersonCamera.gameObject), PrefabUnpackMode.Completely, InteractionMode.AutomatedAction);
                            }
                            GameObject.DestroyImmediate(firstPersonCamera.gameObject, true);
                            (target as FirstPerson).FirstPersonCamera = null;
                        }
                    }
                    // All first person view types need to be switched to the currently active render type.
                    var viewTypes = (parent as CameraController).ViewTypes;
                    for (int i = 0; i < viewTypes.Length; ++i)
                    {
                        var firstPersonViewType = viewTypes[i] as FirstPerson;
                        if (firstPersonViewType == null)
                        {
                            continue;
                        }

                        if (renderType == FirstPerson.ObjectOverlayRenderType.RenderPipeline && firstPersonViewType.OverlayRenderType == FirstPerson.ObjectOverlayRenderType.SecondCamera)
                        {
                            firstPersonViewType.FirstPersonCamera = null;
                            firstPersonViewType.OverlayRenderType = renderType;
                        }
                        else if (renderType == FirstPerson.ObjectOverlayRenderType.SecondCamera && firstPersonViewType.OverlayRenderType == FirstPerson.ObjectOverlayRenderType.RenderPipeline)
                        {
                            firstPersonViewType.FirstPersonCamera = (target as FirstPerson).FirstPersonCamera;
                            firstPersonViewType.OverlayRenderType = renderType;
                        }
                    }
                    UltimateCharacterController.Utility.Builders.ViewTypeBuilder.SerializeViewTypes(parent as CameraController);
                }
                var drawFirstPersonCamera = renderType == FirstPerson.ObjectOverlayRenderType.SecondCamera;
#else
                InspectorUtility.DrawField(target, "m_UseFirstPersonCamera");
                var drawFirstPersonCamera = InspectorUtility.GetFieldValue <bool>(target, "m_UseFirstPersonCamera");
#endif
                if (drawFirstPersonCamera && InspectorUtility.Foldout(target, "First Person Camera"))
                {
                    EditorGUI.indentLevel++;
                    InspectorUtility.DrawField(target, "m_FirstPersonCamera");
                    InspectorUtility.DrawField(target, "m_FirstPersonCullingMask");
                    InspectorUtility.DrawField(target, "m_SynchronizeFieldOfView");
                    var synchronizeFieldOfView = InspectorUtility.GetFieldValue <bool>(target, "m_SynchronizeFieldOfView");
                    if (!synchronizeFieldOfView)
                    {
                        InspectorUtility.DrawFieldSlider(target, "m_FirstPersonFieldOfView", 1, 179);
                        InspectorUtility.DrawFieldSlider(target, "m_FirstPersonFieldOfViewDamping", 0, 5);
                    }
                    var positionOffsetValue = InspectorUtility.GetFieldValue <Vector3>(target, "m_FirstPersonPositionOffset");
                    var positionOffset      = EditorGUILayout.Vector3Field(new GUIContent(InspectorUtility.SplitCamelCase("m_FirstPersonPositionOffset"), InspectorUtility.GetFieldTooltip(target, "m_FirstPersonPositionOffset")), positionOffsetValue);
                    // Set the property if the game is playing so the camera will update.
                    if (positionOffsetValue != positionOffset)
                    {
                        (target as FirstPerson).FirstPersonPositionOffset = positionOffset;
                        InspectorUtility.SetFieldValue(target, "m_FirstPersonPositionOffset", positionOffset);
                    }
                    var rotationOffsetValue = InspectorUtility.GetFieldValue <Vector3>(target, "m_FirstPersonRotationOffset");
                    var rotationOffset      = EditorGUILayout.Vector3Field(new GUIContent(InspectorUtility.SplitCamelCase("m_FirstPersonRotationOffset"), InspectorUtility.GetFieldTooltip(target, "m_FirstPersonRotationOffset")), rotationOffsetValue);
                    // Set the property so the camera will update.
                    if (rotationOffsetValue != rotationOffset)
                    {
                        (target as FirstPerson).FirstPersonRotationOffset = rotationOffset;
                        InspectorUtility.SetFieldValue(target, "m_FirstPersonRotationOffset", rotationOffset);
                    }
                    EditorGUI.indentLevel--;
                }
#if ULTIMATE_CHARACTER_CONTROLLER_LWRP || ULTIMATE_CHARACTER_CONTROLLER_UNIVERSALRP
                else if (renderType == FirstPerson.ObjectOverlayRenderType.RenderPipeline)
                {
                    EditorGUI.indentLevel++;
                    InspectorUtility.DrawField(target, "m_FirstPersonCullingMask");
                    EditorGUI.indentLevel--;
                }
#endif
                EditorGUI.indentLevel--;
            }
            if (InspectorUtility.Foldout(target, "Primary Spring"))
            {
                EditorGUI.indentLevel++;
                InspectorUtility.DrawSpring(target, "Position Spring", "m_PositionSpring");
                var lowerLimit      = InspectorUtility.GetFieldValue <float>(target, "m_PositionLowerVerticalLimit");
                var lowerLimitValue = EditorGUILayout.Slider(new GUIContent(InspectorUtility.SplitCamelCase("m_PositionLowerVerticalLimit"),
                                                                            InspectorUtility.GetFieldTooltip(target, "m_PositionLowerVerticalLimit")), lowerLimit, 0, 5);
                // Set the property if the game is playing so the camera will update.
                if (lowerLimitValue != lowerLimit)
                {
                    (target as FirstPerson).PositionLowerVerticalLimit = lowerLimit;
                    InspectorUtility.SetFieldValue(target, "m_PositionLowerVerticalLimit", lowerLimitValue);
                }
                InspectorUtility.DrawFieldSlider(target, "m_PositionFallImpact", 0, 5);
                InspectorUtility.DrawFieldIntSlider(target, "m_PositionFallImpactSoftness", 1, 30);
                InspectorUtility.DrawFieldSlider(target, "m_RotationStrafeRoll", -5, 5);
                InspectorUtility.DrawSpring(target, "Rotation Spring", "m_RotationSpring");
                InspectorUtility.DrawFieldSlider(target, "m_RotationFallImpact", 0, 5);
                InspectorUtility.DrawFieldIntSlider(target, "m_RotationFallImpactSoftness", 1, 30);
                EditorGUI.indentLevel--;
            }
            if (InspectorUtility.Foldout(target, "Secondary Spring"))
            {
                EditorGUI.indentLevel++;
                InspectorUtility.DrawSpring(target, "Secondary Position Spring", "m_SecondaryPositionSpring");
                InspectorUtility.DrawSpring(target, "Secondary Rotation Spring", "m_SecondaryRotationSpring");
                EditorGUI.indentLevel--;
            }
            if (InspectorUtility.Foldout(target, "Shake"))
            {
                EditorGUI.indentLevel++;
                InspectorUtility.DrawFieldSlider(target, "m_ShakeSpeed", 0, 10);
                InspectorUtility.DrawField(target, "m_ShakeAmplitude");
                EditorGUI.indentLevel--;
            }
            if (InspectorUtility.Foldout(target, "Bob"))
            {
                EditorGUI.indentLevel++;
                InspectorUtility.DrawField(target, "m_BobPositionalRate");
                InspectorUtility.DrawField(target, "m_BobPositionalAmplitude");
                InspectorUtility.DrawField(target, "m_BobRollRate");
                InspectorUtility.DrawField(target, "m_BobRollAmplitude");
                InspectorUtility.DrawFieldSlider(target, "m_BobInputVelocityScale", 0, 10);
                InspectorUtility.DrawField(target, "m_BobMaxInputVelocity");
                InspectorUtility.DrawField(target, "m_BobMinTroughVerticalOffset");
                InspectorUtility.DrawField(target, "m_BobTroughForce");
                InspectorUtility.DrawField(target, "m_BobRequireGroundContact");
                EditorGUI.indentLevel--;
            }
            if (InspectorUtility.Foldout(target, "Limits"))
            {
                EditorGUI.indentLevel++;
                var minPitchLimit = InspectorUtility.GetFieldValue <float>(target, "m_MinPitchLimit");
                var maxPitchLimit = InspectorUtility.GetFieldValue <float>(target, "m_MaxPitchLimit");
                var minValue      = Mathf.Round(minPitchLimit * 100f) / 100f;
                var maxValue      = Mathf.Round(maxPitchLimit * 100f) / 100f;
                InspectorUtility.MinMaxSlider(ref minValue, ref maxValue, -90, 90, new GUIContent("Pitch Limit", "The min and max limit of the pitch angle (in degrees)."));
                if (minValue != minPitchLimit)
                {
                    InspectorUtility.SetFieldValue(target, "m_MinPitchLimit", minValue);
                }
                if (minValue != maxPitchLimit)
                {
                    InspectorUtility.SetFieldValue(target, "m_MaxPitchLimit", maxValue);
                }

                if (target is FreeLook)
                {
                    var minYawLimit = InspectorUtility.GetFieldValue <float>(target, "m_MinYawLimit");
                    var maxYawLimit = InspectorUtility.GetFieldValue <float>(target, "m_MaxYawLimit");
                    minValue = Mathf.Round(minYawLimit * 100f) / 100f;
                    maxValue = Mathf.Round(maxYawLimit * 100f) / 100f;
                    InspectorUtility.MinMaxSlider(ref minValue, ref maxValue, -180, 180, new GUIContent("Yaw Limit", "The min and max limit of the yaw angle (in degrees)."));
                    if (minValue != minYawLimit)
                    {
                        InspectorUtility.SetFieldValue(target, "m_MinYawLimit", minValue);
                    }
                    if (minValue != maxYawLimit)
                    {
                        InspectorUtility.SetFieldValue(target, "m_MaxYawLimit", maxValue);
                    }
                    InspectorUtility.DrawField(target, "m_YawLimitLerpSpeed");
                    InspectorUtility.DrawField(target, "m_RotateWithCharacter");
                }
                InspectorUtility.DrawField(target, "m_LookDirectionDistance");
                EditorGUI.indentLevel--;
            }
            if (InspectorUtility.Foldout(target, "Head Tracking"))
            {
                EditorGUI.indentLevel++;
                InspectorUtility.DrawField(target, "m_SmoothHeadOffsetSteps");
                InspectorUtility.DrawField(target, "m_CollisionRadius");
                InspectorUtility.DrawField(target, "m_RotateWithHead");
                EditorGUI.indentLevel--;
            }
        }
        /// <summary>
        /// Called when the object should be drawn to the inspector.
        /// </summary>
        /// <param name="target">The object that is being drawn.</param>
        /// <param name="parent">The Unity Object that the object belongs to.</param>
        public override void OnInspectorGUI(object target, Object parent)
        {
            // Draw the fields related to rendering.
            if (InspectorUtility.Foldout(target, "Rendering"))
            {
                EditorGUI.indentLevel++;
                InspectorUtility.DrawField(target, "m_LookDirectionDistance");
                var lookOffsetValue = InspectorUtility.GetFieldValue <Vector3>(target, "m_LookOffset");
                var lookOffset      = EditorGUILayout.Vector3Field(new GUIContent(InspectorUtility.SplitCamelCase("m_LookOffset"), InspectorUtility.GetFieldTooltip(target, "m_LookOffset")), lookOffsetValue);
                // Set the property if the game is playing so the camera will update.
                if (lookOffsetValue != lookOffset)
                {
                    (target as FirstPerson).LookOffset = lookOffset;
                    InspectorUtility.SetFieldValue(target, "m_LookOffset", lookOffset);
                }
                InspectorUtility.DrawField(target, "m_LookDownOffset");
                InspectorUtility.DrawField(target, "m_CullingMask");
                InspectorUtility.DrawFieldSlider(target, "m_FieldOfView", 1, 179);
                InspectorUtility.DrawFieldSlider(target, "m_FieldOfViewDamping", 0, 5);
                if (InspectorUtility.Foldout(target, "First Person Camera"))
                {
                    EditorGUI.indentLevel++;
                    InspectorUtility.DrawField(target, "m_UseFirstPersonCamera");
                    InspectorUtility.DrawField(target, "m_FirstPersonCamera");
                    InspectorUtility.DrawField(target, "m_FirstPersonCullingMask");
                    InspectorUtility.DrawField(target, "m_SynchronizeFieldOfView");
                    var synchronizeFieldOfView = InspectorUtility.GetFieldValue <bool>(target, "m_SynchronizeFieldOfView");
                    if (!synchronizeFieldOfView)
                    {
                        InspectorUtility.DrawFieldSlider(target, "m_FirstPersonFieldOfView", 1, 179);
                        InspectorUtility.DrawFieldSlider(target, "m_FirstPersonFieldOfViewDamping", 0, 5);
                    }
                    var positionOffsetValue = InspectorUtility.GetFieldValue <Vector3>(target, "m_FirstPersonPositionOffset");
                    var positionOffset      = EditorGUILayout.Vector3Field(new GUIContent(InspectorUtility.SplitCamelCase("m_FirstPersonPositionOffset"), InspectorUtility.GetFieldTooltip(target, "m_FirstPersonPositionOffset")), positionOffsetValue);
                    // Set the property if the game is playing so the camera will update.
                    if (positionOffsetValue != positionOffset)
                    {
                        (target as FirstPerson).FirstPersonPositionOffset = positionOffset;
                        InspectorUtility.SetFieldValue(target, "m_FirstPersonPositionOffset", positionOffset);
                    }
                    var rotationOffsetValue = InspectorUtility.GetFieldValue <Vector3>(target, "m_FirstPersonRotationOffset");
                    var rotationOffset      = EditorGUILayout.Vector3Field(new GUIContent(InspectorUtility.SplitCamelCase("m_FirstPersonRotationOffset"), InspectorUtility.GetFieldTooltip(target, "m_FirstPersonRotationOffset")), rotationOffsetValue);
                    // Set the property so the camera will update.
                    if (rotationOffsetValue != rotationOffset)
                    {
                        (target as FirstPerson).FirstPersonRotationOffset = rotationOffset;
                        InspectorUtility.SetFieldValue(target, "m_FirstPersonRotationOffset", rotationOffset);
                    }
                    EditorGUI.indentLevel--;
                }
                EditorGUI.indentLevel--;
            }
            if (InspectorUtility.Foldout(target, "Primary Spring"))
            {
                EditorGUI.indentLevel++;
                InspectorUtility.DrawSpring(target, "Position Spring", "m_PositionSpring");
                var lowerLimit      = InspectorUtility.GetFieldValue <float>(target, "m_PositionLowerVerticalLimit");
                var lowerLimitValue = EditorGUILayout.Slider(new GUIContent(InspectorUtility.SplitCamelCase("m_PositionLowerVerticalLimit"),
                                                                            InspectorUtility.GetFieldTooltip(target, "m_PositionLowerVerticalLimit")), lowerLimit, 0, 5);
                // Set the property if the game is playing so the camera will update.
                if (lowerLimitValue != lowerLimit)
                {
                    (target as FirstPerson).PositionLowerVerticalLimit = lowerLimit;
                    InspectorUtility.SetFieldValue(target, "m_PositionLowerVerticalLimit", lowerLimitValue);
                }
                InspectorUtility.DrawFieldSlider(target, "m_PositionFallImpact", 0, 5);
                InspectorUtility.DrawFieldIntSlider(target, "m_PositionFallImpactSoftness", 1, 30);
                InspectorUtility.DrawFieldSlider(target, "m_RotationStrafeRoll", -5, 5);
                InspectorUtility.DrawSpring(target, "Rotation Spring", "m_RotationSpring");
                InspectorUtility.DrawFieldSlider(target, "m_RotationFallImpact", 0, 5);
                InspectorUtility.DrawFieldIntSlider(target, "m_RotationFallImpactSoftness", 1, 30);
                EditorGUI.indentLevel--;
            }
            if (InspectorUtility.Foldout(target, "Secondary Spring"))
            {
                EditorGUI.indentLevel++;
                InspectorUtility.DrawSpring(target, "Secondary Position Spring", "m_SecondaryPositionSpring");
                InspectorUtility.DrawSpring(target, "Secondary Rotation Spring", "m_SecondaryRotationSpring");
                EditorGUI.indentLevel--;
            }
            if (InspectorUtility.Foldout(target, "Shake"))
            {
                EditorGUI.indentLevel++;
                InspectorUtility.DrawFieldSlider(target, "m_ShakeSpeed", 0, 10);
                InspectorUtility.DrawField(target, "m_ShakeAmplitude");
                EditorGUI.indentLevel--;
            }
            if (InspectorUtility.Foldout(target, "Bob"))
            {
                EditorGUI.indentLevel++;
                InspectorUtility.DrawField(target, "m_BobPositionalRate");
                InspectorUtility.DrawField(target, "m_BobPositionalAmplitude");
                InspectorUtility.DrawField(target, "m_BobRollRate");
                InspectorUtility.DrawField(target, "m_BobRollAmplitude");
                InspectorUtility.DrawFieldSlider(target, "m_BobInputVelocityScale", 0, 10);
                InspectorUtility.DrawField(target, "m_BobMaxInputVelocity");
                InspectorUtility.DrawField(target, "m_BobMinTroughVerticalOffset");
                InspectorUtility.DrawField(target, "m_BobTroughForce");
                InspectorUtility.DrawField(target, "m_BobRequireGroundContact");
                EditorGUI.indentLevel--;
            }
            if (InspectorUtility.Foldout(target, "Limits"))
            {
                EditorGUI.indentLevel++;
                var minPitchLimit = InspectorUtility.GetFieldValue <float>(target, "m_MinPitchLimit");
                var maxPitchLimit = InspectorUtility.GetFieldValue <float>(target, "m_MaxPitchLimit");
                var minValue      = Mathf.Round(minPitchLimit * 100f) / 100f;
                var maxValue      = Mathf.Round(maxPitchLimit * 100f) / 100f;
                InspectorUtility.MinMaxSlider(ref minValue, ref maxValue, -90, 90, new GUIContent("Pitch Limit", "The min and max limit of the pitch angle (in degrees)."));
                if (minValue != minPitchLimit)
                {
                    InspectorUtility.SetFieldValue(target, "m_MinPitchLimit", minValue);
                }
                if (minValue != maxPitchLimit)
                {
                    InspectorUtility.SetFieldValue(target, "m_MaxPitchLimit", maxValue);
                }

                if (target is FreeLook)
                {
                    var minYawLimit = InspectorUtility.GetFieldValue <float>(target, "m_MinYawLimit");
                    var maxYawLimit = InspectorUtility.GetFieldValue <float>(target, "m_MaxYawLimit");
                    minValue = Mathf.Round(minYawLimit * 100f) / 100f;
                    maxValue = Mathf.Round(maxYawLimit * 100f) / 100f;
                    InspectorUtility.MinMaxSlider(ref minValue, ref maxValue, -180, 180, new GUIContent("Yaw Limit", "The min and max limit of the yaw angle (in degrees)."));
                    if (minValue != minYawLimit)
                    {
                        InspectorUtility.SetFieldValue(target, "m_MinYawLimit", minValue);
                    }
                    if (minValue != maxYawLimit)
                    {
                        InspectorUtility.SetFieldValue(target, "m_MaxYawLimit", maxValue);
                    }
                    InspectorUtility.DrawField(target, "m_YawLimitLerpSpeed");
                }
                InspectorUtility.DrawField(target, "m_LookDirectionDistance");
                EditorGUI.indentLevel--;
            }
            if (InspectorUtility.Foldout(target, "Head Tracking"))
            {
                EditorGUI.indentLevel++;
                InspectorUtility.DrawField(target, "m_SmoothHeadOffsetSteps");
                InspectorUtility.DrawField(target, "m_CollisionRadius");
                InspectorUtility.DrawField(target, "m_RotateWithHead");
                EditorGUI.indentLevel--;
            }
        }
        /// <summary>
        /// Called when the object should be drawn to the inspector.
        /// </summary>
        /// <param name="target">The object that is being drawn.</param>
        /// <param name="parent">The Unity Object that the object belongs to.</param>
        public override void OnInspectorGUI(object target, Object parent)
        {
            InspectorUtility.DrawField(target, "m_LookDirectionDistance");
            InspectorUtility.DrawField(target, "m_ForwardAxis");
            InspectorUtility.DrawField(target, "m_UpAxis");
            InspectorUtility.DrawFieldSlider(target, "m_FieldOfView", 1, 179);
            InspectorUtility.DrawFieldSlider(target, "m_FieldOfViewDamping", 0, 5);
            InspectorUtility.DrawField(target, "m_RotationSpeed");
            InspectorUtility.DrawField(target, "m_CollisionRadius");
            InspectorUtility.DrawField(target, "m_ViewDistance");
            InspectorUtility.DrawField(target, "m_ViewStep");
            InspectorUtility.DrawField(target, "m_VerticalLookDirection");

            var minPitchLimit = InspectorUtility.GetFieldValue <float>(target, "m_MinPitchLimit");
            var maxPitchLimit = InspectorUtility.GetFieldValue <float>(target, "m_MaxPitchLimit");
            var minValue      = Mathf.Round(minPitchLimit * 100f) / 100f;
            var maxValue      = Mathf.Round(maxPitchLimit * 100f) / 100f;

            InspectorUtility.MinMaxSlider(ref minValue, ref maxValue, 0, 89.99f, new GUIContent("Pitch Limit", "The min and max limit of the pitch angle (in degrees)."));
            if (minValue != minPitchLimit)
            {
                InspectorUtility.SetFieldValue(target, "m_MinPitchLimit", minValue);
            }
            if (minValue != maxPitchLimit)
            {
                InspectorUtility.SetFieldValue(target, "m_MaxPitchLimit", maxValue);
            }
            InspectorUtility.DrawField(target, "m_AllowDynamicCameraRotation");
            var dynamicRotation = InspectorUtility.GetFieldValue <bool>(target, "m_AllowDynamicCameraRotation");

            if (dynamicRotation)
            {
                UnityEditor.EditorGUI.indentLevel++;
                InspectorUtility.DrawField(target, "m_DesiredAngle");
                InspectorUtility.DrawField(target, "m_ChangeAngleSpeed");
                InspectorUtility.DrawField(target, "m_RotationTransitionCurve");
                UnityEditor.EditorGUI.indentLevel--;
            }
            InspectorUtility.DrawField(target, "m_AllowDynamicPitchAdjustment");
            var pitchAdjustment = InspectorUtility.GetFieldValue <bool>(target, "m_AllowDynamicPitchAdjustment");

            if (pitchAdjustment)
            {
                UnityEditor.EditorGUI.indentLevel++;
                InspectorUtility.DrawField(target, "m_DesiredPitch");
                InspectorUtility.DrawField(target, "m_ChangePitchSpeed");
                InspectorUtility.DrawField(target, "m_UseIndependentPitchTransition");
                var pitchTransition = InspectorUtility.GetFieldValue <bool>(target, "m_UseIndependentPitchTransition");
                if (pitchTransition)
                {
                    InspectorUtility.DrawField(target, "m_PitchTransitionCurve");
                }
                UnityEditor.EditorGUI.indentLevel--;
            }
            InspectorUtility.DrawField(target, "m_AllowDynamicDistanceAdjustment");
            var distanceAdjustment = InspectorUtility.GetFieldValue <bool>(target, "m_AllowDynamicDistanceAdjustment");

            if (pitchAdjustment)
            {
                UnityEditor.EditorGUI.indentLevel++;
                InspectorUtility.DrawField(target, "m_DesiredDistance");
                InspectorUtility.DrawField(target, "m_ChangeDistanceSpeed");
                InspectorUtility.DrawField(target, "m_UseIndependentDistanceTransition");
                var distanceTransition = InspectorUtility.GetFieldValue <bool>(target, "m_UseIndependentDistanceTransition");
                if (distanceTransition)
                {
                    InspectorUtility.DrawField(target, "m_DistanceTransitionCurve");
                }
                UnityEditor.EditorGUI.indentLevel--;
            }
            if (Shared.Editor.Inspectors.Utility.InspectorUtility.Foldout(target, "Secondary Spring"))
            {
                UnityEditor.EditorGUI.indentLevel++;
                InspectorUtility.DrawSpring(target, "Secondary Position Spring", "m_SecondaryPositionSpring");
                InspectorUtility.DrawSpring(target, "Secondary Rotation Spring", "m_SecondaryRotationSpring");
                UnityEditor.EditorGUI.indentLevel--;
            }
        }