Packaged build crashes on startup but only for first run

For a while I found that my packaged (dev) builds would crash on start up but regardless of what option (close without sending, send and restart etc) I chose the game would restart itself and everything would function normally. Rerunning the game after this would also function correctly.

I couldn’t work out what was causing it but it wasn’t causing too much of a problem so I just lived with it for a while. Just in case someone else finds something similar, I found out it was being caused by my antivirus (Avast). Adding an exception to the folder where I output builds and everything works fine.

Answered in question.