So, I made a scene with gui text and a background. I made a gui text script which tells it to spell out the letters every 0.1 second, like pokemon. This is my first time using gui text and not sure how to fix this issue. When I play the game and if you play on any type of resolution the gui text will change position. Like 1920x1080 will move the text into the middle. How do I fix this to make the gui text to stay in 1 position for every resolution?
Hi Charliep44
The Unity’s gui system is currently relative to the screen position.
First, you might always want to start with your guitext object on the topmost hierarchy (having no parents), since the parent’s position will affect the child’s.
This is quite simple.
First, you want to know where to lock your text to.
Let’s assume you always want it to be 50 pixels from the left edge of the screen:
- Set the position to x=0, y=0
- Set the anchor to [lower left]
- Set the alignment to
- Set the pixel offset to x=50, y=0
- done!
Ok, that was easy. Now we have text at the bottom, 50px from the edge.
Let’s try setting it 30 pixels from the top, 50 pixels from the right edge:
- Set the position to x=1, y=1
- Set the anchor to [upper right]
- Set the alignment to
- Set the pixel offset to x=-50, y=-30
- done!
One more, let’s put the text right in the middle of the screen!
- Set the position to x=0.5, y=0.5
- Set the anchor to [middle center]
- Set the alignment to
- Set the pixel offset to x=0, y=0
- done!
Yay!