I am trying to learn how to spawn characters and I have run into an issue I don’t know how to search. The route is if you click on an actor already spawned in at start, it spawns a menu with a few choices. In that menu you can click a button right now set to spawn a new actor. However, when it spawns, I am not able to get a response from it via click. What I want is when I click on it for the widget “Army Selection” to appear.
Where is the “OnClicked” event called? Inside your character BP?
Where is the “Event BeginPlay” called? Also inside your character BP?
On clicked is inside the actor itself, Begin Play is in the level.
Okay,
So in your level blueprint you’re actually creating an “Army Selection” widget and are not assigning it to a specific player controller. This is fine in single player games but if its multiplayer you’ll need to specify a player controller.
Also, you’re creating a NEW “Army Selection” widget upon click inside your player BP.
The issue with this is, if you set any information upon creation inside the army selection widget, it will not persist when re-creating it in the character bp.
What I recommend is to create the “Army Selection” widget inside of your Game State BP and make it a variable and then inside of your character bp ‘Cast’ to the Game State. That way when you “Click” the character and call the “OnClicked” event you can grab your reference to the Game State and get the “Army Selection” variable and then add that to the viewport. Any information pertaining to the Character BP that should show in the Army Selection Widget should also be programmed at this “OnClicked” event.
I need to do a little bit more research. I knew I was working outside my knowledge as soon as I read your response. So, when I figure out the missing parts I will come back here but I see why you went with Game State.
If you’d like I can hop on discord and assist you directly