Search Unity

Unity UI showing in Editor, but not in Build

Discussion in 'UGUI & TextMesh Pro' started by Senju, Dec 24, 2014.

  1. touchtolife

    touchtolife

    Joined:
    Apr 2, 2015
    Posts:
    1
    Hi everybody,

    I want to share our solution to fix canvas scale problem after build. Under the Player Settings find "Resolution and Presentation" tab and change the "Full Screen Mode" to "Windowed". Then go to your first scene and open one of the proper script which is loaded at start or create your one. Write the following code inside void start function to make the window full screen automatically after load. In summary, calling the full screen mode before load the scene totally causes instability of some elements and they couldnt position themselves correctly. So make the fullscreen with code after loading of first scene is the stable solution.

    // Toggle fullscreen
    Screen.fullScreen = !Screen.fullScreen;

    Also if sometimes full screen command does not work properly after load, as a solution add the following code inside the void update function too!

    if (Screen.fullScreen == false)
    {
    Screen.fullScreen = !Screen.fullScreen;
    }
     
    Last edited: Feb 20, 2024