I’ve been toying with a simple gamestate manager that basically has three states.
The first GameState is “IntroGameState”, a SplashScreen is displayed, and a Sound is played - the SoundSource has Autoremove Component enabled. I listen for the E_SOUNDFINISHED event, which triggers a state change to the “Main Menu” state.
This state sets up some UI, dumps the current scene to XML File, and then sits there spinning its wheels, and displaying the FPS… So I manually quit the application.
Now, when I investigate the XML Scene File, I can see the SoundSource Component is still attached to my IntroGameState’s container node.
Is this a bug?
<node id="3">
<attribute name="Is Enabled" value="false" />
<attribute name="Name" value="GameIntroSample" />
<attribute name="Tags" />
<attribute name="Position" value="0 0 0" />
<attribute name="Rotation" value="1 0 0 0" />
<attribute name="Scale" value="1 1 1" />
<attribute name="Variables" />
<component type="GameIntroSample" id="1">
<attribute name="My Value" value="666" />
</component>
<component type="SoundSource" id="4">
<attribute name="Sound" value="Sound;Sounds/Fanfare.wav" />
<attribute name="Frequency" value="24000" />
<attribute name="Autoremove Mode" value="Component" />
</component>
</node>
Ugh - nevermind, I found the answer in the Porting Notes for v1.5-1.6
Quote: " SoundSource autoremove functionality is deprecated and will be removed in the future. The SoundFinished event can be used instead to react to playback finishing and to perform the necessary action, for example to remove the sound component or its owner node."
It would be nice if the docs mentioned this too.