UGameplayStatics::PrimeSound
#include "Kismet/GameplayStatics.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Pre-caches the first compressed audio chunk of a streaming sound to eliminate the hitch that occurs the first time it plays. Call this during a loading screen or ahead of a known gameplay event.
Caveats & Gotchas
- • Only effective for sounds using streaming audio (SoundWave with EnableStreaming set); non-streaming sounds are fully loaded at asset load time and do not benefit from priming.
- • This only caches the first chunk, not the entire sound; long sounds may still stall slightly after the first chunk transitions to subsequent chunks on slow storage.
- • The cached chunk can be evicted by the audio streaming cache if memory pressure is high — priming ahead by more than a few seconds may be wasted if the level is asset-heavy.
Signature
static ENGINE_API void PrimeSound(USoundBase* InSound) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InSound | USoundBase* | The sound asset whose first compressed audio chunk should be cached. | — |
Return Type
void Example
Prime boss music before boss encounter C++
// Call this during the loading screen or cinematic before the boss fight
UGameplayStatics::PrimeSound(BossMusicAsset); Tags
Version History
Introduced in: 4.25
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?