/// <summary>
        /// Called every frame to perform any necessary updates.
        /// </summary>
        private void Update()
        {
            if (RuntimeEditorApplication.Instance.UseCustomCamera)
            {
                _camera.enabled = false;
            }

            // Reset the mouse cursor position in the previous frame in order to make sure we don't
            // get wild offset values which will cause unwanted effects.
            if (_applicationJustGainedFocus)
            {
                _applicationJustGainedFocus = false;
                _mouse.ResetCursorPositionInPreviousFrame();
            }

            // Make sure the mouse has its information updated for the current frame update
            _mouse.UpdateInfoForCurrentFrame();

            // Only process input if we are not using a custom camera
            if (!RuntimeEditorApplication.Instance.UseCustomCamera)
            {
                if (_focusOnSelectionShortcut.IsActiveInCurrentFrame())
                {
                    FocusOnSelection();
                }
                //added by me
                if (toolBarController.isFocusing)
                {
                    FocusOnSelection();
                    toolBarController.isFocusing = false;
                }
                //
                if (_zoomSettings.IsZoomEnabled)
                {
                    ApplyCameraZoomBasedOnUserInput();
                }
                PanCameraBasedOnUserInput();
                RotateCameraBasedOnUserInput();
                MoveCameraBasedOnUserInput();
            }

            if (Camera.orthographic)
            {
                Camera.nearClipPlane = 0.000001f;

                // Adjust the near plane such that it doesn't intersect the grid. Otherwise, it cuts
                // away from it and it looks painfully ugly :)
                CameraViewVolume viewVolume = Camera.GetViewVolume();
                var nearPlanePoints         = new List <Vector3>();
                nearPlanePoints.Add(viewVolume.TopLeftPointOnNearPlane);
                nearPlanePoints.Add(viewVolume.TopRightPointOnNearPlane);
                nearPlanePoints.Add(viewVolume.BottomLeftPointOnNearPlane);
                nearPlanePoints.Add(viewVolume.BottomRightPointOnNearPlane);

                Plane xzGridPlane = RuntimeEditorApplication.Instance.XZGrid.Plane;
                if (!xzGridPlane.AreAllPointsInFrontOrBehindPlane(nearPlanePoints))
                {
                    Vector3 pivotPoint = Vector3.zero;
                    float   dot        = Vector3.Dot(xzGridPlane.normal, Camera.transform.forward);
                    if (dot > 0.0f)
                    {
                        xzGridPlane.GetFurthestPointInFront(nearPlanePoints, out pivotPoint);
                    }
                    else
                    if (dot < 0.0f)
                    {
                        xzGridPlane.GetFurthestPointBehind(nearPlanePoints, out pivotPoint);
                    }

                    if (dot != 0.0f)
                    {
                        Ray   ray = new Ray(pivotPoint, -Camera.transform.forward);
                        float t;
                        if (xzGridPlane.Raycast(ray, out t))
                        {
                            Vector3 intersectPt = ray.GetPoint(t);
                            float   distance    = (intersectPt - pivotPoint).magnitude;
                            Camera.nearClipPlane -= distance;
                        }
                    }
                }
            }
            else
            {
                Camera.nearClipPlane = _initialNearClipPlane;
            }

            _background.OnCameraUpdate(Camera, _isDoingPerspectiveSwitch);

            if (_transform.hasChanged)
            {
                SetObjectVisibilityDirty();
                _transform.hasChanged = false;
            }
        }