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

GUITexture Display Correctly In Viewport ?

Discussion in 'Immediate Mode GUI (IMGUI)' started by Deleted User, Oct 28, 2014.

  1. Deleted User

    Deleted User

    Guest

    Hi,

    Let me layout an example, I have a GUITexture, the texture attached is 512x512, I'm displaying this on a 1200x800 screen resolution, my texture is set to Texture Type = Sprite (2D \ uGUI ), in the GUITexture options, all my pixel inset values have been set to 0, Left, Right, Top, Bottom Borders are all set to 0 also, I have a script attached that scales things automatically for me during runtime. Now, the main problem I have is displaying the GUITexture in the unity viewport itself at the correct scale, I have positioned it at the centre, x = 0.5, y = 0.5, based on my calculations my scale is set at X = 0.426667, Y = 0.64, ( I worked this by calculating 1200 width / 512 = 0.426667, and height 800 / 512 = 0.64 ), even those these should be the correct values, the texture does not appear square in my viewport, I have to say my GUIRescaler script handles it perfectly runtime, but I want to visualise my GUITexture in the standard 'Game' viewport also, any help, thanks ?