Unreal 4.10.2, playing from code fails randomly

(Davor) #1

I’m implementing some weapon shooting mechanics from code. At some point, I’d like to play fmod event for weapon fire.

I have a UPROPERTY reference
UFMODEvent* FireSound;
I call
UFMODBlueprintStatics::PlayEventAttached(Sound, MuzzleDirection, NAME_None, FVector(), EAttachLocation::Type::SnapToTarget, false, true);
(MuzzleDirection is an arrow component that points form the muzzle, it’s always valid).

Sound artist loads his banks and sets up FireSound from the editor.

Problem is, this works, but fails randomly (every shot except first one can be heard…). Sometimes just inserting any kind of unrelated instruction (like print to log call) before PlayEventAttached call makes it either stop working alltogether (no sound played at all), or makes it work 100% times. I have a feeling the problem could have something to do with resource laoding, but I really can’t find what I’m doing wrong.

Help :frowning:

(Geoff Carlton) #2

Could you contact support@fmod.com and we can chase that up. I’d like to get some more details, and if possible a cut down project that demonstrates the problem.

(Davor) #3

I will, thanx!

(Geoff Carlton) #4

Please see the answer in the following post regarding early loading of some blueprints and how to make sure FMOD is loaded first. There is a good chance this could explain what you are seeing.


(Davor) #5

It sounded like something that could eplain my problems, but unfortunately we don’t even use c++ base for our gamemode at this point. Is there anything in blueprints that could be using the same kind of issues?

(Geoff Carlton) #6

Is there any other c++ code that uses FClassFinder? Can you search for it in your project and see if it shows up anywhere?