Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Game works in EDITOR but not in build?

Discussion in 'Editor & General Support' started by Midnightb, Jun 28, 2017.

  1. Midnightb

    Midnightb

    Joined:
    Dec 24, 2015
    Posts:
    127
    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?
     
  2. Midnightb

    Midnightb

    Joined:
    Dec 24, 2015
    Posts:
    127
    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.
     
  3. Dreamwriter

    Dreamwriter

    Joined:
    Jul 22, 2011
    Posts:
    472
    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.
     
  4. Midnightb

    Midnightb

    Joined:
    Dec 24, 2015
    Posts:
    127
    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.
     
  5. Midnightb

    Midnightb

    Joined:
    Dec 24, 2015
    Posts:
    127
    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.
     
  6. domraGames

    domraGames

    Joined:
    Oct 19, 2018
    Posts:
    2
    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
     
  7. Dreadator

    Dreadator

    Joined:
    Mar 17, 2017
    Posts:
    1
    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.
     
    Rbrinks likes this.
  8. Nsingh13

    Nsingh13

    Joined:
    Dec 17, 2014
    Posts:
    18
    Fixed my problem for me too. Def. a bug on Unity's side.
     
  9. vladutstefan27

    vladutstefan27

    Joined:
    Sep 9, 2018
    Posts:
    5
    nothing on my end :-/
    hours and hours and still no solution
     
  10. Petchinsky

    Petchinsky

    Joined:
    Jul 26, 2019
    Posts:
    1
    Thanks for the solution. The same thing happened to me. Unity should automatically take care of deleted tags but doesn't.