My game works as intended in the editor, but when I build and run, it seems like part of one of my scripts stops working. I use the same script to open doors and to control a machine that dispenses health, but In build the health machine does nothing. Why does my game work in the editor but not when I build and run?
It is worth mentioning that I don’t get anything in the console when I play the game in the editor besides my Debug logs that I set. No errors that I know of.
You can look at your console for debug logs and errors and stuff from the build - if it’s a PC build it’s in the XXX_Data folder as output.log, other devices have it in other places.
One common issue that causes different functionality between the editor and builds, are scripts that must be initialized in a specific order - the order each Awake function is run in can change between editor and build, same with the order Start is run and Update, unless you set the ScriptExecutionOrder.
I have several scripts that control doors and machines. How am I supposed to know the order that they need to execute in? They should all be running at the same time, I think, but I could be wrong.
Solved the issue, but Im not sure how.
I looked in the list of tags I had created and noticed that one of them said “(removed)” but it stayed on the list. It said to restart the editor to make it go away, so I did. Ta-da, my game suddenly worked in build. I’m still not sure if that is what caused it, however.
Yeah I also had this problem… I was frustrating for hours hahah. It was simple, because I deleted a tag and it will delete when you restart Unity. So restarting Unity solved the problem
Bro, you just saved me. Had the same issue with it working in the editor and not in build due to a bloody removed tag! Thanks bro I was beginning to go insane, I had tried everything apart from restarting unity lol.
Fixed my problem for me too. Def. a bug on Unity’s side.
nothing on my end :-/
hours and hours and still no solution
Thanks for the solution. The same thing happened to me. Unity should automatically take care of deleted tags but doesn’t.
I have similar problem. My game works great in Unity but in Build some scripts does not work properly.
My player (spaceship) shoots only few times and when other script start working (enemy spawner) my player can’t shoot any more.
I have no tags and it stil doesnt work
I am also having this problem. My character moves with platforms in the editor, but lags behind in a build. What is happening?
my game build is working but it is not showing my character and enemies but my player is colliding with enemies
Hey if you’re still struggling with this. Deleting the build folder and making a new one (instead of overwriting it) worked for me. (:
Thank you for this, I couldn’t figure out why the game I’m working on wasn’t detecting a saved game/load PlayerPrefs correctly in an executable (worked fine in the editor) and the ScriptExecutionOrder wasn’t correct. Which I could tell from Debug statements in the output.log - so thanks for that too.
Hi,
Had this problem for hours and finally figured it out.
It seems that Unity’s default Tag references causing most of the issues.
Try to:
- Replace references to default tags with your tags (“+Add Tag” at the end of the tag list).
- Don’t use tag references if you can (FindObjectWithTag → FindObjectOfType).
Hope it will help someone =]
Still dont worked for me only the Player Works but the Rest dont work i scripted my game with Bolt i tryed everything for days but nothing work for me
For any one who tries all means in this thread but still does not solve the problem, check if you have code used for debug (method print() excluded), such as Debug.Assert()., which will be deleted in the build version.
hey , i have similar problem i am using addressables to load a bunch of items on my scrollbar when i hit play it loads all items but when building into the device no items load ,anyone knows how to fix this, please help ,thanks