Play audio clip by name

Hi everyone,

I have a dynamic talk system which determines which lines are to be said when. I wanted to achieve the simple thing - to play a clip based upon the key.

Let’s say - I have a datatable with key 101 and I want to play file located in:

Content\Audio\VoiceOvers\Audio\VO101

I thought it would be trivial but regardless what I do, I never found a way to do this dynamically without having to select the vo from combobox.

I also tried to use C++ but it crashes engine with “FObjectFinders can’t be used outside of constructors to find USoundWave”

Any help will be appreciated!

Thank you.

Use Asset ID (which in reality is reference path that you use FObjectFinders) to get object of asset based on reference path, if you set up things right you will be able to get asset with specific number on them. there node that get asset from Asset ID:

https://docs.unrealengine.com/latest/INT/BlueprintAPI/Utilities/ResolveAssetID/index.html

Remeber that asset need to be loaded first, engine do that automaticly if you gave asset used in specific property in defults but if you get asset manually you need to check if it’s loaded and if not, load it:

https://docs.unrealengine.com/latest/INT/BlueprintAPI/Utilities/LoadAsset/index.html

In C++ FObjectFinders can be used only in construction, to do it dynamicly you either try using UObjectLibrary, or the easiest and simplest is just use FStringAssetReference (which is same type as Asset ID type in blueprint like FVector is Vector in blueprint), it has function that let you load and get asset from it self:

https://docs.unrealengine.com/latest/INT/API/Runtime/CoreUObject/Misc/FStringAssetReference/index.html

Thank you!