- Home /
My game breaks after building it (standalone)
Ok so, I'm making my game, everything is fine in the editor, it all works. After I build the game, EVERYTHING FALLS APART! It seems the GameObject.FindObjectWithTag doesn't work, it gives me a null reference exception and I have to make a variable for it. Stuff thats supposed to be always visible in the UI is now only visible when I... look at the door?? (I have an interact raycast script but the door does not do anything when just hovered over.) And a script which works perfectly fine in the editor is broken in the build. Did I mess up something in the player settings? Does enabling development build have something to do with it? Please someone help me. Thank you.
(note: the amount of keys not only shows when I look at the door, it shows when I look at things with an interact script)
Answer by olejuer · Feb 02 at 08:41 AM
Check the logs. It depends on your OS where to find them https://docs.unity3d.com/Manual/LogFiles.html
Make sure you have the correct scene setup as the starting scene in your build settings. In the editor, load the first scene in your build scene index and see if you can reproduce your issues in the editor then. Have you added all scenes that are loaded during gameplay to the build scene index?
It is very unlikely that development build setting is at fault.
You can also make your build debuggable and attach a debugger to see exactly whats going on.
Also, please understand that "door, keys, amount of keys, interact, hovered, look at" are all concepts that only make sense to you and without knowing your project they are meaningless (I don't want them explained, they are probably not relevant to the issue at hand).