UE4 Quick Tutorial / How to stop sounds overlapping

preview_player
Показать описание
I needed a way to prevent too many sounds playing at one time. I came up with this method to block a sound from playing if one is active.
Рекомендации по теме
Комментарии
Автор

I improved this event, thank you very much to Vigeo James.

Game Mode Blueprint

1) In game mode add an audio component
2) Create a custome event (PlayVoice)
3) Add a branch
4) Create a bool variable (IsPlayingAudio) from Branch condition
5) From True branch, call a SetSound function, plug the audio component, and from its NewSound input, create an output from PlayVoice custome event (just drag it towards the custome event it will automatically create an output)
6) Call a Play function and plug the audio component
7) Set IsPlayingAudio bool var to false
8) call a Delay function, from Duration input, create an output from PlayVoice custome event
9) Set IsPlayingAudio bool var to true

Any Blueprint Actor

10) Get game mode, then Cast a Game mode, and plug it from Begin Play in the Blueprint, create a var from Game Mode, and Set it
11) Use the Custome Event PlayVOice now as a function
12) Get Game Mode var and call the PlayVoice custome event
13) Place a Sound from its NewSound input
14) Set a value in Duration input ( according audio length)

That's it

Anublack
Автор

You saved me after an hour of fiddling around, Thank you haha

GEKdev
Автор

This only works in a blueprint "Event Graph", annoyingly that time delay node won't work in a function

derekcfoley
Автор

What is the name of the node that you calculate duration from in your video? the blue>green one at the bottom? I can't seem to put one in my blueprint because I don't know what its command is!

derekcfoley
Автор

could you animate you lips when you speak?

lisatapelefond