- Home /
Game not working correctly in build mode?
i created a 2D game in unity 5 with a menu as a separate scene that takes you to the game on button press, but once build the game screen still shows a bit of the menu on the right of the screen. the camera for the menu and the game are the exact same size and they work fine in unity, i tried a few different settings like free aspect and 16:9 but it always happens. i have no idea why it occurs and is the last obstacle to overcome before i can hand this in. below is an example of the problem and the code i used to transition between scenes.
The Problem: (http://i.imgur.com/L7mXcr3.png)
Script for transition wrote in C# (most of this code is for button positioning on the menu): using UnityEngine; using System.Collections;
public class MainMenu : MonoBehaviour {
public Texture backgroundTexture;
public GUIStyle Random1;
public GUIStyle Random2;
public float guiPlacementY;
public float guiPlacementX;
public float guiPlacementY2;
public float guiPlacementX2;
void OnGUI(){
GUI.DrawTexture (new Rect (0, 0, Screen.width, Screen.height), backgroundTexture);
//PLAY
if (GUI.Button (new Rect(Screen.width * guiPlacementX, Screen.height * guiPlacementY, Screen.width * .5f, Screen.height * .2f),"", Random1)){
Application.LoadLevel ("ArrowDash");
}
//QUIT
if (GUI.Button (new Rect(Screen.width * guiPlacementX2, Screen.height * guiPlacementY2, Screen.width * .45f, Screen.height * .2f),"", Random2)){
Application.Quit();
}
}
}
in review it seems as though my game scene is scaling itself in on the x axis, as all the cameras are the same size yet my game camera doesn't fill the screen