i have almost completed my first game when i ran into the gui problem. when i change the aspect ratio or go on maximize on play, the gui buttons randomly get placed on the screen. i am a complete noob at fixing this as i have tried to search the fourms and did not understand what ppl were saying.
first of all how should i go about fixing this
secondly i know i have to make a script to fix this but where do i place the script into. do i put it in all my gui stuff or an empty game object or what?
all help will be greatly appritiated. i hope somone can help me.this is the only thing stoping me from releasing my game so plz help
It depends, how are you drawing your gui, are you using screen coordinates to place them, or are you using GUILayout.
If you’re using screen coordinates, it’s obvious that you need them to respect screen size, like for example you need to multiply ‘x’ coordinate by aspect ratio, so whenever screen size is increased by width (for ex., from 4x3 to 16x9), the ‘x’ coordinate will move forward.
This kind of goes with what tct is saying, but a good way to handle GUI placement is by placing and sizing with fractions of the Screen’s height and width.