FMOD/UE4 4.20 FMODAudioComponent Stop causing component to be destroyed

I set up a basic blueprint for playing and stopping an audio component. This is a simplified version of a larger blueprint that I had working in 4.19 so I could test this issue/change/whatever it is ( feature? :stuck_out_tongue: ) in 4.20.

https://imgur.com/77Jjtgu

When play gets called the first time, the sound plays. Then, after a delay, Stop gets called, which stops the sound. The next tick shows that the component is invalid, but oddly enough, it attempts to play one more time, where I get this:

https://imgur.com/DbjinKg

It seems that when calling Stop, I somehow lose my reference to the component, or the event instance (not sure which).

This worked in 4.19, but hasn’t worked in 4.20. Any help would be appreciated.

Here is the relevant part of the UE log:

[2018.08.31-01.08.49:266][ 2]PIE: Play in editor start time for /Game/ThirdPersonCPP/Maps/UEDPIE_0_ThirdPersonExampleMap -0.119
[2018.08.31-01.08.49:266][ 2]LogBlueprintUserMessages: Late PlayInEditor Detection: Level ‘/Game/ThirdPersonCPP/Maps/ThirdPersonExampleMap.ThirdPersonExampleMap:PersistentLevel’ has LevelScriptBlueprint ‘/Game/ThirdPersonCPP/Maps/ThirdPersonExampleMap.ThirdPersonExampleMap:PersistentLevel.ThirdPersonExampleMap’ with GeneratedClass ‘/Game/ThirdPersonCPP/Maps/ThirdPersonExampleMap.ThirdPersonExampleMap_C’ with ClassGeneratedBy ‘/Game/ThirdPersonCPP/Maps/ThirdPersonExampleMap.ThirdPersonExampleMap:PersistentLevel.ThirdPersonExampleMap’
[2018.08.31-01.08.50:041][ 46]LogBlueprintUserMessages: [NewBlueprint_2] Play
[2018.08.31-01.08.51:041][106]LogBlueprintUserMessages: [NewBlueprint_2] Stop
[2018.08.31-01.08.51:124][111]LogBlueprintUserMessages: [NewBlueprint_2] Invalid
[2018.08.31-01.08.52:041][166]LogBlueprintUserMessages: [NewBlueprint_2] Play
[2018.08.31-01.08.52:041][166]LogScript: Warning: Attempted to access FMODAudioComponent_0 via property AudioComponent, but FMODAudioComponent_0 is pending kill
NewBlueprint_C /Game/ThirdPersonCPP/Maps/UEDPIE_0_ThirdPersonExampleMap.ThirdPersonExampleMap:PersistentLevel.NewBlueprint_2
Function /Game/ThirdPersonCPP/Blueprints/NewBlueprint.NewBlueprint_C:ExecuteUbergraph_NewBlueprint:00C5
[2018.08.31-01.08.52:041][166]PIE: Error: Blueprint Runtime Error: “Attempted to access FMODAudioComponent_0 via property AudioComponent, but FMODAudioComponent_0 is pending kill”. Blueprint: NewBlueprint Function: Execute Ubergraph New Blueprint Graph: EventGraph Node: Play
[2018.08.31-01.08.54:465][311]LogBlueprintUserMessages: Early EndPlayMap Detection: Level ‘/Game/ThirdPersonCPP/Maps/ThirdPersonExampleMap.ThirdPersonExampleMap:PersistentLevel’ has LevelScriptBlueprint ‘/Game/ThirdPersonCPP/Maps/ThirdPersonExampleMap.ThirdPersonExampleMap:PersistentLevel.ThirdPersonExampleMap’ with GeneratedClass ‘/Game/ThirdPersonCPP/Maps/ThirdPersonExampleMap.ThirdPersonExampleMap_C’ with ClassGeneratedBy ‘/Game/ThirdPersonCPP/Maps/ThirdPersonExampleMap.ThirdPersonExampleMap:PersistentLevel.ThirdPersonExampleMap’

Thanks for reporting this issue, we’ve reproduced it internally and are investigating a fix for it now. I’ll update this question with a workaround if possible, and an eta for a fix.

Cheers
Derek

On further investigation we have found we can produce the same behavior with a similar configuration using a particle system from the UE4 starter content:

LogBlueprintUserMessages: [NewBlueprint1_106] Start
LogBlueprintUserMessages: [NewBlueprint1_106] Stop
LogBlueprintUserMessages: [NewBlueprint1_106] Invalid
LogBlueprintUserMessages: [NewBlueprint1_106] Start
LogScript: Warning: Attempted to access ParticleSystemComponent_0 via property Particle System, but ParticleSystemComponent_0 is pending kill
NewBlueprint1_C /Game/FirstPersonCPP/Maps/UEDPIE_0_FirstPersonExampleMap.FirstPersonExampleMap:PersistentLevel.NewBlueprint1_106
Function /Game/Blueprints/NewBlueprint1.NewBlueprint1_C:ExecuteUbergraph_NewBlueprint1:00B6

I think this suggests an issue with the way the blueprint rather than any issue in FMOD.

You mentioned that you had a more complex blueprint which was working in UE4 4.19 and it sounds like that isn’t working in UE4 4.20? If you’re able to share the actual blueprint or other means of reproducing the issue then we could take a look at that for you.

Cheers
Derek

Thanks for looking in to this, Derek.

I may have been slightly wrong about what the problem is exactly. Testing further on another system with a clean install of UE4 and FMOD UE4 Integration (1.10.08), I noticed the same problem even in 4.19. Looking back at my original setup on my original system, I noticed that in 4.19, I was running 1.10.07, and in 4.20, running 1.10.08.

So, again, testing on a clean system, 1.10.08 showed the same symptoms in 4.19 as in 4.20. I switched to 1.10.07 and the problem went away.

Feel free to clone my small test project from GitHub (built in UE 4.19). https://github.com/Ashaelon/ProjectMaze

The 3 instances that play the sound are NewBlueprint, NewBlueprint3, and NewBlueprint4. NewBlueprint2 doesn’t have BP_Light_Flicker attached as a child (on purpose). You may need to select one or all of those, click the BP_Light_Flicker child, search for the property ‘Max Particle Sound Volume’ and set it to something higher than 0 (I’ve been setting it to 3). When you play, just stand next to the first set of lights. The one to the left of the player is NewBlueprint. If you test with 1.10.07, you should (hopefully) hear a sparking sound every time sparks emit. In 1.10.08, you will only hear the spark sound 1 time.

I couldn’t figure out a better way to get this blueprint and all associated “assets” to you, along with explaining how to set it up. This way you can hopefully see exactly what I see.

Thanks Ashaelon

I downloaded your project and was able to see the issue you’re describing.

I can confirm this is a behaviour change in our 1.10.08 integration where audio components created by Play Event Attached are automatically destroyed when the event is stopped. In 1.10.07 the component would be automatically destroyed only if the event played to completion; calling Stop on the component would prevent the automatic destruction.

I’ve scheduled a fix for this in our next release. The fix will be to expose a checkbox to blueprints to control whether the audio component created by Play Event Attached should be automatically destroyed when the event finishes playing. Once that is exposed you’ll be able to untick the checkbox to revert to the 1.10.07 behaviour.

In the meantime I suggest you stick with our 1.10.07 integration if possible. If you are compelled to move to 1.10.08 then the only workaround I can see is to modify your blueprint to call Play Event Attached where you currently set the “Can Play Sound” flag in “Set particle system flicker if particle system exists”.

Cheers
Derek

For now, since I’ve moved to UE4.20 for other reasons, and 1.10.07 doesn’t work in 4.20, I’ll implement the workaround until the fix is released.

Thanks for the help! Looking forward to the fix.