Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Object position compared to UI

Discussion in 'UGUI & TextMesh Pro' started by Kimpanzy, Apr 10, 2024.

  1. Kimpanzy

    Kimpanzy

    Joined:
    Sep 2, 2023
    Posts:
    5
    So i have made a UI, with some text objects and a background. Look at the pictures.

    But when i place a object that is not a child to the canvas, the gameobject does not show up on the cavas or where i placed it in the correct way.

    The first picture is the scene, were i have a blue triangle and on the right is the same scene but in game view and you cant even see the whole thing. What have i done wrong or what do i need to do to fix it?
     

    Attached Files:

  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,092
    Here are the official docs on how to make your UI handle various resolutions and aspect ratios cleanly:

    https://docs.unity3d.com/2023.1/Documentation/Manual/HOWTO-UIMultiResolution.html

    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

    Usually you need to choose a suitable ScaleMode and MatchMode in the Canvas Scaler and stick with it 100%. Generally if you change those settings you will often need to redo your UI entirely.

    I also use this
    CanvasScalerOrientationDriver
    utility to make sharing UI for Landscape / Portrait easier. Read what it does carefully.

    https://gist.github.com/kurtdekker/8802b1b6c708637398f8c9167641efd3