So I’ve tried to create a basic music manager here, a component I’ve added to Gamestate so I was hoping it’d persist between levels. However, whenever I change levels my ‘active track’ variable becomes None. I feel like I’m misunderstanding something important here.
Music Manager component in Gamestate.
Music Manager events. I’ve circled the active track, which is getting set correctly in the main menu’s level blueprint.
Then when the tutorial loads, the active track becomes none. Here’s the tutorial’s level blueprint.
I’ve verified that BP_Gamestate is being used by my gamemode:
And that my gamemode is being used.
It has occurred to me just now that Gamestate doesn’t persist between levels. Now I see why they created seperate events for each song instead of generic ‘set/play/stop’ functions. It’s in fact gameinstance that persists. However, I am not sure how to add my Music Manager to my gameinstance BP? Since you can’t seem to add components to it.
Hey there @JGoodroad! Generally retaining data would be put into the Game Instance and then “unpacked” when needed, but if you want true persistence, you may need to create a Game Instance derived class or a Game Instance Subsystem and translate the audio handler to it, which (I think!) should retain persistence functionality of the GI.
2 Likes