My game works perfectly in Unity, but not when I build

Hi guys,

Something strange is going on with my game. I’m making a hangman game which works perfectly in the unity editor. Also when I click ‘build and run’, the game works as it should, flawlessly. However when I click the .exe a second time, it just doesn’t work anymore. The main menu shows up, I click play and the countdown timer counts down, I can see the category of the hangman game, but I cannot type anything in, it just show the default text option which is ‘Guess word’. No errors in the console window either.

I’ve never had this happen before.

The odd thing is, like I said before, when I choose to ‘build and run’, the game works fine. But when I just click ‘build’ the game compiles with no errors, but just doesn’t load as it should.

I’m at a total loss as to why this is happening…especially since there are NO error to go by.

I’m using Unity version 2020.3.2f1 Personal (LTS) on windows 10.

thanks in advance!

Do you have some external files for the game to load? (eq: txt for all words)
when you test it in editor or editor launch it in the first time, the path root is at the project folder. but when you launch the build yourself, the path root is at the folder containting your build. If this is the case, you should place your external files to StreamingAssets folder.

btw, please the log file, it may help

Hi SunnyChow,

Thanks for taking the time to read and reply to my question. After days of trying to solve this I was finally able to. After I changed the fields (string) to public instead of private it’s working like a charm! I still don’t understand why the game was working in Unity itself with private strings, and not in the final build, but I’m already happy I got it resolved after many frustrating days.