Search code examples
c#build2dresolutionunity-game-engine

Keeping the scene inside the screen - Unity


beginner-ish Unity developer here.

I have made a simple Unity game and I have a problem when building it. I cant get the game to stretch to fit the size of the game window when built outside of Unity.

In the Unity scene when I am working, I set the camera to encompass a specific area of the scene that has my background objects and level and everything inside the camera view. The problem is when I build the game out of Unity the screen is a different size depending on the resolution setting, and the game objects(backgrounds, etc) doesnt stretch to fit anymore. So I either get the game going on in the center of the screen with the blue Unity space all around it where there is nothing, or the screen is too small and parts of the game are cut out(missle count, score) at the edges of the game.

I know there is a way to set this stuff up, but I am not sure where to start. Can anyone give me some info or point me in the right direction?

Thanks!


Solution

  • See link. http://docs.unity3d.com/Manual/class-PlayerSettingsStandalone.html

    Also when designing GUIs see example GUI.Button (new Rect((Screen.width / 2) - 510, (Screen.height / 2) + 150, 200, 30) http://answers.unity3d.com/questions/307330/gui-scale-guis-according-to-resolution.html