Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Game not Working when Built

Discussion in 'Editor & General Support' started by YBtheS, Mar 21, 2019.

  1. YBtheS

    YBtheS

    Joined:
    Feb 22, 2016
    Posts:
    239
    I was programming a game that was working perfectly fine in the editor. When I built it, it seems that all of the features worked except for one. The game has a mechanic where enemies will be activated (chase the plaer rather than being idle) when they have a line of sight of the player (using lincasting). This worked in the editor but when built, only a single enemy gets activated and the rest stay idle regardless of distance. I then went to plan B and changed the program so that it wasn't based on line of sight but rather distance (using Vector3.Distance). That also worked in the editor but not as a built .exe file. No errors have shown up even though I set the build to be a developer build and there are none in the editor either. It doesn't seem to be a problem with the activation method as if I set the enemies to be active in the Start method, they will chase the player from the start as expected. Does anyone have any ideas about why the behavior of the game would change like this just by building it?
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    YBtheS likes this.
  3. YBtheS

    YBtheS

    Joined:
    Feb 22, 2016
    Posts:
    239
    Thanks for the response. I did that and was able to resolve the issue.