# Unreal 4.10.2, playing from code fails randomly

**URL:** <https://qa.fmod.com/t/unreal-4-10-2-playing-from-code-fails-randomly/12296>\
**Category:** Unreal Engine\
**Created:** [February 9, 2016, 5:04am UTC](https://qa.fmod.com/t/unreal-4-10-2-playing-from-code-fails-randomly/12296 "2016-02-09T05:04:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![davor](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@davor](https://qa.fmod.com/u/davor)\
**Post date:** [February 9, 2016, 5:04am UTC](https://qa.fmod.com/t/unreal-4-10-2-playing-from-code-fails-randomly/12296/1 "2016-02-09T05:04:12Z")

</div>

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 ☹

---

<div class="post-metadata">

**Author:** ![geoff](https://avatars.discourse-cdn.com/v4/letter/g/a3d4f5/32.png) [@geoff](https://qa.fmod.com/u/geoff)\
**Post date:** [February 9, 2016, 11:30pm UTC](https://qa.fmod.com/t/unreal-4-10-2-playing-from-code-fails-randomly/12296/2 "2016-02-09T23:30:01Z")

</div>

Could you contact [support@fmod.com](mailto: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.

---

<div class="post-metadata">

**Author:** ![davor](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@davor](https://qa.fmod.com/u/davor)\
**Post date:** [February 10, 2016, 1:21am UTC](https://qa.fmod.com/t/unreal-4-10-2-playing-from-code-fails-randomly/12296/3 "2016-02-10T01:21:40Z")

</div>

> [@](#):
>
> Could you contact [support@fmod.com](mailto: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.

I will, thanx!

---

<div class="post-metadata">

**Author:** ![geoff](https://avatars.discourse-cdn.com/v4/letter/g/a3d4f5/32.png) [@geoff](https://qa.fmod.com/u/geoff)\
**Post date:** [February 16, 2016, 4:53am UTC](https://qa.fmod.com/t/unreal-4-10-2-playing-from-code-fails-randomly/12296/4 "2016-02-16T04:53:17Z")

</div>

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.

[http://www.fmod.org/questions/question/cannot-play-fmod-events-in-package-build/](http://www.fmod.org/questions/question/cannot-play-fmod-events-in-package-build/)

---

<div class="post-metadata">

**Author:** ![davor](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@davor](https://qa.fmod.com/u/davor)\
**Post date:** [February 16, 2016, 6:12am UTC](https://qa.fmod.com/t/unreal-4-10-2-playing-from-code-fails-randomly/12296/5 "2016-02-16T06:12:50Z")

</div>

> [@](#):
>
> 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.
> 
> [Cannot play FMOD events in package build - Unreal Engine - FMOD Forums](http://www.fmod.org/questions/question/cannot-play-fmod-events-in-package-build/)

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?

---

<div class="post-metadata">

**Author:** ![geoff](https://avatars.discourse-cdn.com/v4/letter/g/a3d4f5/32.png) [@geoff](https://qa.fmod.com/u/geoff)\
**Post date:** [February 16, 2016, 6:19am UTC](https://qa.fmod.com/t/unreal-4-10-2-playing-from-code-fails-randomly/12296/6 "2016-02-16T06:19:35Z")

</div>

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