[BUG] AudioStreamPlayer node does not clear after action playback sound

AudioStreamPlayer duplicate generation bug.zip (1.6 MB)

Reproduction Steps:

  1. Open the project and enter the project test :backhand_index_pointing_up:

  2. Press the Z key to play the AudioStreamPlayer (a node that does not get cleared)

  3. Press the X key to play the AudioStreamPlayer2D (a node that does not display)

  4. Then open the remote scene tree on the left to view the nodes of the core scene

  5. Continuously pressing Z results in the creation of many AudioStreamPlayer nodes that are not cleared

Problem Location:

  1. Located in the game object’s VS [State Machine] → [Action] → [Play Sound]

  2. If AudioStreamPlayer2D is not enabled, AudioStreamPlayer nodes are repeatedly generated

1787303104453 (1)

Additional Observation: Furthermore, after repeatedly playing the audio, when returning to the character interface scene, playing the root node’s AudioStreamPlayer-bug, AudioStreamPlayer-bug2, and AudioStreamPlayer2D-bug3 in the inspector on the right results in overlapping, repeated sounds.

AI Analysis:

Why does this happen?

The PlayAudio action in AGM has two hardcoded destruction logic paths:

  1. :white_check_mark: AudioStreamPlayer2D branch: The plugin automatically connects the finished signal internally and calls queue_free() to delete the temporary node after the audio finishes playing, so the scene tree does not accumulate nodes.
  2. :cross_mark: Standard AudioStreamPlayer branch: The plugin does not bind an automatic release logic for the finished signal. After the sound effect finishes playing, the node remains in the scene tree, merely stopping sound output. Each time you switch weapons and trigger playback, a new node is created, leading to accumulation.

The standard AudioStreamPlayer itself has a finished signal; it’s just that this AGM action does not connect automatic destruction for the standard version, only providing release code for the 2D version.

  1. Also, I noticed that when I press F5 to reset the game, the remote nodes on the left side still exist.
  2. It seems that saving and loading might also involve the presence of audio nodes.
  3. Even after switching scenes using a portal, the audio persists.

It might be related to the issue described here:

https://guild.rpgmakerofficial.com/t/topic/1152

【BUG】After 【Execute Load】, the more loads, the louder the sound / Saving fails randomly under multiple save nodes

This problem originates from there.