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
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.