- Home /
2D camera scaling
In my 2D game I rescale the cameras orthographic size via code to fit the player velocity. The faster the player is, the more he can see.
However, I still want some objects on my screen to remain the same (not shrink/move) in relation to the camera. these are all children of the camera (health bar, for example) thanks!
Are you using GUI elements? In most cases those aren't affected by the camera's size, even with orthographic cameras.
I am not. Come to think about it you are right this may be the simplest solution.. Are GUI elements efficient?
They seem to work really well for me. If you're using one of the older versions of Unity (like 4.5), you'll be stuck with the older GUI system which is considerably more difficult to work with. The 4.6 beta, however, utilizes the brand new nGUI system which is better in almost every way and much easier to use!
If you don't already have the 4.6 beta, I'd highly recommend giving it a shot. If for any reason it doesn't work well for you, you can always revert back to the old version.
If you're using the 4.6 beta, click here for some excellent official nGUI tutorials. Additionally, here's another great nGUI tutorial that was done during one of Unity's live training sessions.