- Home /
Finding size of texture GUI
Hey guys and gals! heres my issue, I'm making a game for android and was trying to get it so it scales according to the screen size. i figured that bad boy out but now when i launch the game. my GUI's ,tho scaled correctly , are not positioned in the right spot. so my solution was going to be something along the lines of this.
function Start()
{
/////////// figure out where the GUIs should go.\\\\\\\\\\\\\
screenWidth = Screen.width;
screenHeight = Screen.height;
pullPosition.x = screenWidth - (SHP* pullGraphic.width) - buffer;
pullPosition.y = screenHeight - (SHP*pullGraphic.height) - buffer;
}
SHP is a variable i made that helps control the scaling of the GUI. so basically i wanted to find how wide the screen was then subtract the GUI texture size once scaled and subtract a buffer which moves is slightly inwards from the edge. then repeat for the height, thus making my GUI in the bottom righthand corner of screen BUT i can't figure out how to get the pullGraphic's width, i've messed around with making that variable a Texture2d, and just a regular texture and so far no luck. I'm sure there is a super simple solution to this that is slipping past me so any help you guys can provide would be awesome!! thanks
Your answer
Follow this Question
Related Questions
"Non power of 2" Textures - How to access original size? 3 Answers
Importing texture, problem with size - width and height get changed 3 Answers
Texture2D.PackTextures - attempt to determine if texture was scaled 0 Answers
In Sprite Editor, how can I get theese values by code? (screenshot) 1 Answer
Sprite slicing problem 1 Answer