Playing sound effects
When it comes to playing any type of sound, Unreal gives you more than one method and you have to pick the one that fits you and the situation of that sound. The most common and popular methods I've found are:
- Through C++ code: You can play the sound of any
AudioComponent
, by simply using the member functionPlay()
and, yes, just one line to run a sound.AudioComp.Play(float StartTimer);
- Through blueprint nodes: Within a blueprint you can simply play sound using any of the Play Sound nodes. You can play a 2D sound, which means it will have the same volume always, or play it at a location in order to fade the sound in and out while getting closer or further away from it.
- Through animation notifications: Just as we used to set an animation notification to call some parts of the code, in the same way you can add a notification of the type PlaySound and it has its own options within the notifications menu.
After adding it, selecting the notification itself, will give you...