UGameplayStatics::SetActiveSpatialPluginByName
#include "Kismet/GameplayStatics.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Switches the active audio spatialization plugin at runtime to the one identified by name. Returns true on success, false if the named plugin is not available.
Caveats & Gotchas
- • Switching plugins at runtime re-initializes the audio spatialization pipeline, which can cause a brief audio glitch or silence; do not call this mid-gameplay without user acknowledgement.
- • The change only affects the local audio device; in a multiplayer session, each client must call this independently to have consistent spatialization.
- • Only plugins that were loaded at startup (and returned by GetAvailableSpatialPluginNames) can be activated; the function returns false silently for unknown plugin names.
Signature
static ENGINE_API bool SetActiveSpatialPluginByName(const UObject* WorldContextObject, FName InPluginName) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| WorldContextObject | const UObject* | Object used to obtain the world context. | — |
| InPluginName | FName | Name of the spatialization plugin to activate, as returned by GetAvailableSpatialPluginNames. | — |
Return Type
bool Example
Switch to a named spatialization plugin from settings C++
FName DesiredPlugin = FName("OculusSpatializationPlugin");
bool bSuccess = UGameplayStatics::SetActiveSpatialPluginByName(this, DesiredPlugin);
if (!bSuccess)
{
UE_LOG(LogTemp, Warning, TEXT("Spatial plugin '%s' not available."), *DesiredPlugin.ToString());
} See Also
Tags
Version History
Introduced in: 4.24
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?