Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How can I get my cards to scale correctly on different resolutions?

Discussion in 'UGUI & TextMesh Pro' started by Joggla, Jun 6, 2023.

  1. Joggla

    Joggla

    Joined:
    Dec 2, 2019
    Posts:
    88
    Hello,
    im am making a simple card game and need to get the ui working correct...
    when i press draw card a card gets drawn and i instantiate an image
    upload_2023-6-6_19-45-15.png
    the image get added to the game and then looks like this:
    upload_2023-6-6_19-45-59.png
    this is when the game is on full screen.
    however if i change the play mode to focused and not play maximize the card looks bigger after drawing it:
    upload_2023-6-6_19-47-21.png
    how can i make it that the created image is a constant size regardsless of the screen size and aspect ratio?

    it seems that the image is always a constant pixel size of 100x 100y regardless of the size of the other elements

    the canvas settings are:
    upload_2023-6-6_20-5-30.png

    if i go into the editor and add an image with the size of 90 90 it looks perfect:
    upload_2023-6-6_20-6-28.png
    however if the image is created as a prefab with the same scale being 90 90 it looks aweful like the screenshots before

    however i have noticed that the scale is off when i instantiate the image
     
    Last edited: Jun 6, 2023
  2. Joggla

    Joggla

    Joined:
    Dec 2, 2019
    Posts:
    88
    upload_2023-6-6_20-10-1.png
    why does it change the scale when i instantiate it?
     
  3. Joggla

    Joggla

    Joined:
    Dec 2, 2019
    Posts:
    88