Build behaves differently than Play Mode

hello, i do most of my testing in play mode and everything is fine in there, however when i run the build/exe, i have a lot of different behavior and i dunno why

examples:

void OnGUI()
{
                if (m_UserListOpen)
                {
                    m_UserListRect = GUI.Window(0, m_UserListRect, CreateUserListWindow, "User List");
                }
}

    void CreateUserListWindow(int windowID)
    {
        if (GUI.Button(new Rect(200 - m_CloseButton.width, 0, m_CloseButton.width, m_CloseButton.height), m_CloseButton))
        {
            m_UserListOpen = false;
        }
        //more code
        GUI.DragWindow();
   }

the code works as intended in play mode (the button closes the window, and the window drags fine), however in the build, the window hangs when i try to close it via the button, and the drag functionality does not work at all most of the times

another issue i am having is that when a user receives an error, it should display the error instead of the normal gui until they press the “ok” button, again, this works as intended in play mode, however in the build, the label is drawn on top of the original gui when it should be instead of it and not with it

    void OnGUI()
    {
        if (error)
        {
            GUI.Label(new Rect(0, 0, Screen.width, Screen.height), errmsg);
            if (GUI.Button(new Rect(0, Screen.height - 20, 40, 20), "ok"))
                error = false;
        }
        else
        {
//gui here
        }
   }

play mode:

build mode:

any help is appreciated, thanks

You should check out the editor log. Guess you’ll find errors there.

Editor log path @ Windows 7: C:\Users\YourUsername\AppData\Local\Unity\Editor\Editor.log

i see the log, but really see anything out of the ordinary, or maybe i don’t understand what im looking for

here’s the log of a build and run trial where i produce the incorrect username message then close the program (sorry, don’t know how to condense it):

These are warnings only, so seems to be the human error. :slight_smile:

Could you supply the whole script? Or simplest example (a minimalistic package) if the script is dependent on resources.

i wrote my code with a windows form in mind however i recently switched to unity and i’m trying to recreate all of the gui function so some of the code (the unused variables) are not implemented/complete yet

unfortunately, i can’t provide the full script since it connects to a local server and requires a mysql database, however i’ve attached the script that creates the gui onto unity

thanks for any help

1071646–40012–$MainGUI.cs (13.2 KB)

I said “the simplest example”. It would be really hard to use it without the class definition of User, Server classes… :slight_smile:

Try the script with different project before attaching it :wink:

i have recreated the gui with some dummy variables, and the same problem occurs

i reattached the entire test project, thanks

1072713–40057–$unity test.zip (6.74 MB)