Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Editor camera skewed...

Discussion in 'Editor & General Support' started by Kas_, Sep 1, 2023.

  1. Kas_

    Kas_

    Joined:
    Dec 27, 2017
    Posts:
    51
    This bug has been in unity since the beginning and still hasnt been fixed... After normal editor use the scene camera becomes skewed at a weird angle, which forces you do delete scene tab and re-add a new scene tab to fix this issue. Can the unity team please fix this, it's crazy that this bug has been in the editor for this long.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
    Usually just selecting any object and pressing F while the mouse is over the scene should fix it.
     
    CodeSmile likes this.
  3. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,769
    What does 'skewed at a weird angle' actually mean? Is the perspective warped or something?
     
    CodeSmile likes this.
  4. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,833
    I remember in some versions of Unity there are some edge cases where the in-Scene camera can get rotated in such a way that all the camera's "up" vector is no longer parallel to world "up", and then it's a challenge trying to get it back straight. You're stuck with a dutch angle from then on. But I haven't had that problem in years.
     
    Kas_ likes this.
  5. Kas_

    Kas_

    Joined:
    Dec 27, 2017
    Posts:
    51
    Read halley's reply, that better describes the issue
     
  6. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,833
    In any case, it looks like you could do something like this as a quick fix:

    Code (CSharp):
    1. #if UNITY_EDITOR
    2. using UnityEditor;
    3. // ...
    4.     [MenuItem("Edit/Straighten Camera")]
    5.     static void StraightenCamera()
    6.     {
    7.         SceneView last = SceneView.lastActiveSceneView;
    8.         Vector3 foward = last.rotation * Vector3.forward;
    9.         last.rotation = Quaternion.LookRotation(forward, Vector3.up);
    10.     }
    11. #endif