UAudioComponent::SetFloatParameter
#include "Components/AudioComponent.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallablevirtualoverride
Description
Sets a named float parameter that is forwarded to the sound instance if it is currently playing, or applied at next play otherwise.
Caveats & Gotchas
- • This is the most common way to drive continuous MetaSound inputs (e.g. an engine RPM or intensity value) from gameplay code without restarting the sound.
- • Updates are suppressed on already-playing instances if bDisableParameterUpdatesWhilePlaying is true, so continuous drivers like a Tick-based RPM update will silently stop propagating if that flag is set.
Signature
UFUNCTION(BlueprintCallable, meta = (DisplayName = "Set Float Parameter"), Category = "Audio|Parameter")
virtual void SetFloatParameter(FName InName, float InFloat) override; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InName | FName | The name of the parameter to set, matching a parameter interface exposed by the sound. | — |
| InFloat | float | The value to assign to the named parameter. | — |
Return Type
void Example
Drive a continuous engine RPM parameter C++
void AVehicle::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
EngineAudioComponent->SetFloatParameter(TEXT("RPM"), CurrentRPM);
} See Also
Tags
Version History
Introduced in: 5.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?