I am making a TBS game and am currently working on the HUD, I have tried different code types and all were unsuccessful.
For example part of the HUD is the minimap that i want to root to the top left corner of the screen, it works for one resolution but when i switch to a different one it appears in a different location.
I have looked through the forums and either the answer doesn’t work or the question is not answered.
What is the best way to fix it?
I know this post is old but, did you ever figure this out? I believe I am experiencing the same issue and there still appears to be no straight answer online. Or at least none I can find.
the center of the screen is half way along the x axis and half way along the y axis or
just FYI an ‘f’ after a number makes it a float in case you were unaware.
We have already solved tons of other minimap problems here (4 month of developement + bugfixing + content creation). This unity3d minimap works out of the box, is fully customizeable and if you will need an additional feature just make a feature request at kolmich.at/forum.
The standard solution is to set GUIs/miniMaps/etc… once at the start, and then rerun those calculation whenever the window changes size. Actually, the most common fix is just to never let the user change size – run only full-screen. Can you even resize iOS/Android apps?
Some systems provide an OnResize() callback, where you can just paste the “setup GUI coords” code. Unity doesn’t have that (I assume since not all platforms support it?) So you have to check “did the screen size change” yourself (goggle “Unity resize callback.”)
I know this post is old but, did you ever figure this out? I believe I am experiencing the same issue and there still appears to be no straight answer online. Or at least none I can find.
– Zerconic