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? ) in 4.20.
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:
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.
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.
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.
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.
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â.
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.