Accessing a bool from another blueprint class

I’m trying to spawn a character that the player chooses in a different level from a game mode menu. I am able to spawn one character, but no matter what character is chosen it spawns in the same spot. I decided to try to have the buttons in the game mode menu set a bool to either true if one character is chosen or false if the other is chosen. However, each time I try to call this bool in my sidescrollergamemode BP I keep getting an error. I’m VERY new to Unreal, so any help is appreciated. The following is my sidescrollergamemode BP and the GameModeMenu BP:

How did you get the Not Human bool that’s causing an error in your game mode? It’s not a variable that’s present in your game mode, so it’s normal that you are getting an error.

Did you drag and drop it from your menu BP into your game mode BP? You can’t do that, and the result is that it’s trying to find the variable but it can’t because it defaults to “self” (the game mode BP) as the target.

When you use Open Level, all blueprints (except Game Instance) and actors are destroyed and then re-created once the level finishes loading, but none of the values carry over. The only way to carry over data from a previous level is to store it in the game instance (or a save file but that is more complex), which I see you’re already doing for something else.

You should have the “Not Human” variable in your game instance instead of your menu, and change it in the game instance from your menu, then fetch it from the game instance in your game mode.

Thank you I did just as you said and put a bool isHuman into the game instance blueprint. Everything looks good and no errors, but it’s still not doing as it should. It just spawns the character on the monkey side of the battle area no matter which character button I clicked first. Here are the screen shots of my updated blueprints.

It looks fine, not sure why it’s not working.

Try putting a breakpoint on the Cast to G Instance node in your BattleArena level (press F9 on the node). This will freeze the game when it gets to that node and then you can click the Step button (where the Play button would normally be) to go through your script step-by-step and see what actually happens.

You should be able to see what the value of your bool is then, so if it always goes to the Monkey side regardless of which button youve pressed, then I would start investigating the part where you press the buttons and set the bool (you can use Print String nodes and/or breakpoints to figure out exactly what is happening).

Also, make sure you don’t have a Player Start in that BattleArena level. That might be interfering with your stuff since you’re spawning and possessing the player manually, but the player start might be doing the same thing as well and messing things up.

I put the breakpoint at all of the Cast to G_Instance nodes and the branch. It turns out the blueprints aren’t even checking the isHuman bool to move on to the branch, and I can’t figure out why. It’s starting to get really frustrating. I did have a Player Start in the BattleArea map, but that is what was keeping the character from spawning below the terrain. Now since I deleted the Player Start for both the Human and Monkey sides of the map the character just spawns under the terrain like I said above, and the reason is the branch isn’t even being checked to get to the transform nodes.

I was thinking… do I need to put anything in the BattleArea level blueprint for all of this to work? Like I said I’m pretty new to this, so I’m not really sure how everything talks to each other yet.

I’m just bumping my question.