I am using the StaticLoadObject function to load an audio file that is about 7 seconds long. Put simply, the load occurs with a special event, let us say when I press a certain keyboard key. Playing the game in the editor, the game starts fine but when I press the key the game freezes for about 5 seconds and then runs smoothly again. Subsequent loading calls for the same object do not cause lag spikes.
Is there something that can be done about the lag spike? I am thinking of loading all objects at the beginning of the game so the lag spikes only occur initially and not mid-game. Will that work or are the objects unloaded automatically at some point?