This usually isn’t the best thing to do, but you can create a hardcoded reference like FSoftObjectPath("/Game/Path/To/AssetName.AssetName")
and call TryLoad()
on it. It’ll load and you can cast the UObject*
to the correct type. Loading from disk can take a long time, but this is a cheap call if the asset is loaded already.
Usually though (if this is on a UObject or Actor or in a UStruct) you just want to declare a UPROPERTY pointer with an asset picker UI, which is easy enough:
UPROPERTY(EditAnywhere, Category="MyCategory")
USoundBase* SoundBase;
That’ll give you an asset picker dropdown where you can choose the asset to reference. Then SoundBase
will point to that asset.