Fatal error during save

This was a one-off crash, although I think the callstack shows pretty solidly where the problem is: Since SavePackage is slow, it updates the UI while it is running, and part of the UI update causes the editor to try to play a sound which calls StaticFindObject() to get a reference to the sound asset.

There’s a race condition between the map auto-save completing (which ends the serialization ‘lock’ on being able to call StaticFindObject()) and the target platform launch completing (which triggers the “Launch successful!” pop-up and sound effect).

One of the following seems likely to be the cause:

  1. Maybe it’s actually OK to call StaticFindObject() on editor-ui-assets during serialization so the assert and following crash are the result of too-aggressive checking of safety.
  2. Maybe the UI shouldn’t be ticked during serialization when the system is in an ‘unsafe to do arbitrary work’ state (although it would be unresponsive instead, which is also bad)
  3. Maybe the UI shouldn’t be using StaticFindObject to get its data during regular ticks and instead fetch all needed objects during startup or some other ‘safe’ time.