Store "Pawn" variable on GameInstance from a wiget
Greetings community, this site has been a huge encyclopedy but now i seek information that doesn't seem to be already ansered.
I am working on a battle RPG map (say, oldschool fnal fantasy style) and i am on the phase of spawning the characters, both enemy and player's. I have created "pawn" type variables on the gameinstance, i intend to store on those variables the enemy types that will be spawn on the map, depending wich area the player is crossing.
For the time being i created a simple widget to allow myself to set those "pawn" variables manually so i can continue wit other aspects of the game.
This is the blueprint for it
Explained: when you click the button, it cast to the game instance (also gets game instance for reference), set's a bolean to true (this is a mark for wether the button is clicked, for other process) casts the game instance again (maybe unnecessary or redundand but there it is) and checks if the content of a combobox is equal to "cave needle" if it is, then proceeds to get al actors from class "ave needle", gets a copy, and stores the pawn to the "Eslot1" variable that is stored on the gameinstance.
I've beent esting and debuging, so far the boolean that is stored on the gameinstance is set to true with no problem, therefore i believe the "cast to game instance" is not the issue, also the branch condition in wich the content of the combobox and the string are equal ecause when debuging the nodes "bright" as they are continuing ot the next one, but whenever i call the conent of the variable "eslot1" it returns "None" as if the variable is empty.
Any guiding on this issue is very appreciated, and thanks for reading!
asked Jun 05 '18 at 08:38 PM in Blueprint Scripting
I'm not sure I understand, do you spawn any CaveNeedle before calling this code ?
And also, yes casting twice is not useful here, just use the output of your first cast, or even store it in a variable for future use as casts can be expensive.
answered Jun 06 '18 at 08:57 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here