- Home /
Rect.Contains Screen Resolution Problem
Hello everyone,
I developed a game menu that contains textures and rects and interacts with clicks. But when I resize my video game's screen, I lose mouse-rect interaction.
Can anyone tell me that how can I resize my rects automatically like textures? Because GUI matrix does not resize rects.
P.S. I did not use Screen.height, Screen.width or any other stuff to resize the GUI.
Answer by JPCannon · Sep 26, 2013 at 07:36 AM
Little error svenskefan... you use screen.width, screen.height. Should be Screen.width and Screen.height like you say before. One letter but creat big problem :)
Answer by svenskefan · Sep 11, 2012 at 05:47 AM
Well, I guess you are onto something by mentioning Screen.width and Screen.height ;)
My suggestion is to create and modify them using a percentage of Screen.width and Screen.height.
But when I use Screen.height/width, I cannot resize my GUI. Do you have any suggestions about this problem or any links to share to solve?
Answer by svenskefan · Sep 11, 2012 at 01:08 PM
setup your rects like rect1=new rect(0,0,Screen.width*0.5,Screen.height*0.5)
this way they will adopt to a changing screen size.
Your answer
Follow this Question
Related Questions
Possible to return the names of gameobjects inside a rect? 1 Answer
How to maintain high resolution custom background images for GUI elements on different screen sizes? 0 Answers
Pick sensible resolution for FullScreen Mac App 2 Answers
Screen.SetResolution doesn't work when the game starts windowed? 0 Answers
GUI label dimensions bug 2 Answers