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

GUITexture and screen position for every resolution

Discussion in 'Immediate Mode GUI (IMGUI)' started by FraMarSaMi, May 13, 2014.

  1. FraMarSaMi

    FraMarSaMi

    Joined:
    May 13, 2014
    Posts:
    86
    How Can I position my GuiTexture on the same position in every screen resolution ?

    Thank you
     
  2. Ravel

    Ravel

    Joined:
    Nov 21, 2010
    Posts:
    605
    You can use GUIMatrix
    scale it to a native resolution. The only downside is that in groups gui pivots get messed, so avoid rotations in groups.
    Search for gui scaling matrix
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    If you're talking about actual GUITexture objects, they use viewport space so are already positioned the same on every resolution, as long as you avoid using the pixel inset for positioning.

    --Eric
     
  4. MisterX_Dev

    MisterX_Dev

    Joined:
    Apr 6, 2014
    Posts:
    8
    There is example for this ? :-(
     
  5. MisterX_Dev

    MisterX_Dev

    Joined:
    Apr 6, 2014
    Posts:
    8
    Eric I had try it but also if I not use pixel inset the GuiTexture are not in the same position If I use smartphone with different screen resolution...
     
  6. MisterX_Dev

    MisterX_Dev

    Joined:
    Apr 6, 2014
    Posts:
    8
    Ah ok ok I don't want it ! I want that the guiTexture is at the same position BUT from left border ! If I put the guibutton into the bottom angle on the left I want that if I change the screen resolution it stay there !
     
  7. DarkNeo

    DarkNeo

    Joined:
    Apr 27, 2014
    Posts:
    53
    I am also having a similar problem and I am still searching for a perfect way to do this, for me I am using the Penelope dual Joysticks in both corners of the screen.


    I have not used pixel inset and have used the transform in the inspector to get the position on the screen for my dual sticks, and I have just used this code to try and fix the scaling/stretching problem. Now I need to make it so the Joysticks actually work again, it seems like the Penelope ones almost rely on the Pixel inset value.

    http://www.devination.com/2014/01/unity-gui-tutorial-scale-gui-to-right.html