How to get string variable from another widget blueprint?
how do I access a string variable in a widget blueprint different from my other blueprint For example: say I have a Login Widget Blueprint with a Player Name string variable set public that gets set in it upon login How do I access that string variable from another blueprint? I tried doing like a direct reference to the Get Player Name, but then it asks for a Target which is where I get confused...
Here are screenshots
Thats in the login blueprint and then in my displaymessage blueprint
how do I actually call that variable "Player Name" from the Displaymessage widget blueprint?
asked Feb 28 '17 at 01:36 AM in Blueprint Scripting
Basically what you would need to do is simply store this string variable somewhere where it can be accessed. Because you mentioned you would like this to be the login information, and possibly get this information whether you are in a menu or in game.
The best place would either be saving out this data locally in a save game file, OR alternatively you could set this in the Game Instance (Which is consistent across the game session). This will allow you to Get the game instance -> Cast to the Game Instance -> And **Get**ting the Player Name variable.
Keep in mind that each client will only see their own Player name variable. If you would like other players to know about this name then setting this within the player state when the game starts (From the game instance/save game at the start of the game).
Hope this helps!
answered Feb 28 '17 at 10:30 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here