Getting Current Character for GameInstance

Hi all, I’m trying to save the current character I’m on and pass that to the game instance so that when a level is loaded it remembers the character I was on and then start the new map with the new character. You can see my switching system here: Switch Characters - Not Mesh - Character & Animation - Epic Developer Community Forums

Also, I posted a pic of the system

Before you leave the level, stash you character class in the GI, then pull it back out on the next level:

Sounds Ideal, but how would I pull my current class from the array I have at the moment? Or am I getting the current class from the gameinstance? Also, would leaving and new level be in the event graph for the gameinstance or in the “door” that is opening the new level?

When you’re busy switching character, just keep a note of the index you used in the array. When you go to change levels, you know which class to save.

There’s as many ways to change levels as there are waves in the sea, or something like that.

Wherever you have your code to do the level switch, that’s a logical place to do what’s in the pic above…

Thank you again for the answer. I think I’m just getting stuck at how to store the class from that switching code. (I.e. Keeping a note of what index im on)

First you need to set up an actor class varable in your default game instance bp. Next, you’ll pull off the ‘Get’ for the class. At the red circle, you’ll have a ‘get game instance’ then plug that into a ‘cast to “YourDefaultGameInstance”’ and off of that, you’ll pull to ‘SetClassVariable’ and plug the get pin from the left into that node as the red line depicts.

Then on your next level, you’ll get game instance, get the class, and spawn that actor and have the player controller take control of the actor by default.

Hey man, thanks for the help. It took me a long time to get my head around what I was doing, and with some help we came up with this. Might help someone down the road. Basically made two functions that Store and load values in the game instance. I then just Store those values all around my playercontroller where needed and load them on event beginplay.