|
Hi all, I'm using the following code to create a wayfinder in my game interface that rotates to indicate the direction of the next objective. Works perfectly.
I'm now trying to implement to resolution independence code from the 3D Platformer tutorial so that the game interface will rescale for different resolutions. The graphics are designed for a 1024 x 768 resolution and adding the lines
where nativeVerticalResolution is set to 1024, and scaledResolutionWidth replaces Screen.width in my previous code, successfully rescales the other graphic in the interface, a health indicator (in a different script). However, with the wayfinder, it's pivot point is wrong and I get a null reference exception error, regardless of which resolution I pick in the Game window. Actually, I get the same error when changing resolutions without the resolution independence code. I found a post on the forums regarding problems with the mouse position where the answer was that the mouse's co-ordinates didn't match those of the new screen resolution, and the following lines were provided as a solution. Is this appropriate in my case?
(comments are locked)
|
|
I'm wondering if part of your problem is that you are scaling your gui in both X and Y by Screen.height / nativeVerticalResolution. Also you seem to have Vertical and horizontal resolution switched. Why don't you try something like:
I have used this succesfully for (part of) my GUI. This way you are scaling both X and Y by appropriate proportions. I think in this case you would not use your scaledResolutionWidth. For a fixed aspect ratio, the code is the same (since Screen.width/width == Screen.height/height).
Feb 19 '11 at 10:35 AM
Waz
(comments are locked)
|
