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 Camera GIZMO wrong size

Discussion in 'Editor & General Support' started by amiga4K, Nov 1, 2021.

  1. amiga4K

    amiga4K

    Joined:
    Jan 30, 2018
    Posts:
    68
    In Unity 2021, after version 2021.1.4, when I created a new 2D project the camera gizmo the gizmo is not perfectly aligned with the scene grid.
    Please see the image below:

    cam.png

    This happen with every camera size.

    Look also this:

    Unity_mkCspKSSCu.png

    The border bottom border of the camera gizmo is not aligned with the square grid of the scene.
    The camera stay at 0,0,-10 as usual and has a size of 5 as usual.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,756
    It won't be unless the combination of your Game window aspect ratio and your ortho height line up to one of these magical scene line markers.
     
  3. amiga4K

    amiga4K

    Joined:
    Jan 30, 2018
    Posts:
    68
    This is not aligned when I created a new project with default settings:

    Game Window -> Free Aspect
    Camera mode -> Ortho with size 5


    Can you post me an example of what are you saying? Because there is no way to make that things aligned.

    Until Unity version 2021.1.4 all was ok...

    Thanks
     
    Last edited: Nov 1, 2021
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,756
    Make this something fixed such as 2:1 and it will line up fine, but why do you care?

    I'm guessing you either didn't notice or didn't have the Game Window set to Free Aspect.

    You can anchor anything you want any way you want. If you want it to follow the left edge, you must anchor it there, otherwise you must do your own anchoring code, which would be madness considering the UI does it for you.

    Here are some notes on UI Anchoring, Scaling, CanvasScaler, etc:

    https://forum.unity.com/threads/inc...size-between-two-people.1130146/#post-7261747

    https://forum.unity.com/threads/game-ui-button-size-problem.1142650/#post-7337383
     
  5. amiga4K

    amiga4K

    Joined:
    Jan 30, 2018
    Posts:
    68
    Oh, it's useful when, for example, you want to align sprites from a border... Those are sort of like guides for me...
    for example look at the picture below: the red square is "cut" and in fact the same happens in the game view.

    Unity_NTbUUsTf7u.png

    Yes but I want to align not using canvas or other UI elements. Only sprite rendered element.

    Maybe I am missing something?

    Thanks for your support.
     
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,756
    Sprites live in world coordinates.

    The camera dimensions affect view of this world based on camera settings plus display aspect.

    If you need it constant you need to force a particular aspect ratio and then deal with letterboxing.