Software works in editor but not in build

Hello everyone,

I am working on a simulation. Currently, this simulation has a simple AI that assigns an agent one of 8 positions. An old version of the project assigned these positions randomly. I have since changed the code to assign these positions in order 1 through 8. This works correctly in the editor. However, when I run a build of the project, these positions are back to randomized. It is like it is running an old version of the code. Other changes to the scripts are reflected in the code.

I’ve tried the applicable suggestions in this thread: Script not working in build - ok in editor

More specifically, I’ve removed post-processing pipeline, checked for empty tags, checked if anything was set as EditorOnly, removed one line of code that was an #if UNITY_EDITOR, moved the project to a different machine, upgraded my Unity version (started in 2019.1.5f, now in 2019.2.6f), reimported all assets, clearing the project cache, making my script execution order explicit, and more I can not remember. I’ve been checking the player.log file as I’ve been debugging and there have been no errors.

Does anyone else have any suggestions to try or have run into this issue?

So I figured this out. I use findobjectswithtag to make a list of the gameobjects that were at the positions I wanted the AI to go to. In the editor, these objects would always be found in the same order. However, in the build, the order would be different (making it look randomized). I explicitly gave the order of the objects in the script and now everything works the same in the build and editor.