Hi
I have another problem with changes of resolution : as the image shows i have a very simple floating health bar over a turret in my tower defence project, if i play with the default resolution (in the left) the bar appears where is supposed to but if i change the resolution, it’s y axis is totally messed up (right of the image) and the difference gets bigger if i move the camera forward. This is the code i use so i already covered the problem with the y coordinates that happens when you use WorldToScreenPoint.
auxPosition = Camera.main.WorldToScreenPoint(currentTurret.gun.transform.position);
//Health Bar
GUI.DrawTexture(new Rect(auxPosition.x - 25, Screen.height - auxPosition.y, 50, 5), damageTexture, ScaleMode.StretchToFill);
GUI.DrawTexture(new Rect(auxPosition.x - 25, Screen.height - auxPosition.y, ((float)currentTurret.currentHealth / (float)currentTurret.baseHealth) * 50.0f, 5), healthTexture, ScaleMode.StretchToFill);
Now, i know there are alternative solutions (like using a texture in the world space) but i want to give a last shot to this to see if there’s any solution, so please if somebody has any idea please share it.
Thanks.
