Spawn actor from widget in another level

Hello guys,

I’m back with another small problem that i can’t figure out. I’m in “main menu” and i want that when i click a widget button to spawn my player in another level. I managed to spawn the character in current level which is main menu and to change the levels with “open level” in my widget blueprint but they don’t work together to change the level and spawn the player…
I guess my spawn actor nodes, spawn the actor in main menu level but i’m not sure about this since the maps changes :smiley:

This is my widget blueprint:

Ideas? Thanks

assuming this isn’t a network game, you’ll probably want to put this logic into your game instance and game mode. so in your menu widget, on clicked, tell the game instance how many players should be spawned, and then in your level that loads, with whatever game mode is assigned to that level, on beginplay in that level’s game mode, create a function or custom event that checks the game instance for how many players it should spawn, and then spawn those players.

ya, this is all blueprint based. out of curiosity, what is your default pawn set to in your level that loads? or what are you trying to accomplish with setting up a spawn in the main menu first? not sure what you’re trying to achieve here in the long run.

Isn’t this possible only with blueprints? I don’t really know C++ and i’m still stuck

Ok let me explain you a little bit better so you can understand.
I have that main menu level, in which i select my character to play. When i click on that character a widget appears, and when i click on that widget i want to spawn to another level or map to play from there. Like in a rpg

This is just the character select screen to give you an idea, and when you press play on the widget it teleports you to that level and get in control of the “class” you selected

I want to make the exact same thing, i have that ok button how it’s in that game, but i don’t manage to spawn it into another level. There is no default pawn in my levels because of how i’ve made the menu. I mean in that “third person example map” i can’t play if there isn’t a spawn actor and posses it in map’s blueprint

makes sense now. one approach would be, create a custom game instance class blueprint and in project settings, maps and modes, assign your game instance drop down menu to your new class. then in that custom game instance class, create new variable ‘playerClassSelected’ or whatever you want to call it. back in your menu widget, when the player selects their character, get your game instance, cast to your custom game instance, and then assign player class variable equal to what was selected in the widget. in your game mode for the new level loaded, on beginplay, get your custom game instance, and plug the variable in the game instance ‘playerClassSelected’ into the class pin of the spawn actor node, after which you can possess it.

what kind of class is your warrior class? is it character or pawn based?

I’ll try this out and come back with a feedback. I think it’s going to work!

I managed to to it somehow but it seems like i can’t connect the posses in pawn node to spawn actor return value node. Is there another thing i should use?

is a blueprint…I don’t really know.This is in the game instance.He’s an actor

If i change it to pawn i can’t edit the variable anymore so it doens’t spawn anything. This is everything i made so far

instead of actor class type, just change it to pawn class type.

Doesn’t matter it was supposed to be a purple pawn instead of a blue one. THANK YOU SO MUCH, LIKE SO MUCH.YOU’RE THE BEST AND THANK YOU FOR YOUR TIME. i would like to shake your hand now. Thank you

Thanks Man. Do you have some page to follow you ? Maybe Youtube page ?