tranfering variables to other blueprints

Hello, I’m relatively new to blueprint scripting. I watched and searched for tutorials on global variables, but I’m having a struggle. Currently I’m trying to implement a client side login system, where first client makes a account and then after it creates a new widget called main menu. And on the main menu I wanted to show the user’s stats such as usernames and levels and high score. I’m trying to make the username typed on the previous widget (User-Creation Menu) to the UserMainMenu widget. But whenever you go to other widget such as options in mainmenu and come back to mainmenu it disappears. And I know that every time when you close a widget it resets and deletes the variable. Can somebody help me?

This is from the UserCreation menu where the Username text variable is sent to mainmenu.

This is the function in User mainmenu widget.

And this is me trying to get save username function in User main menu. (But doesn’t work) I know the problem lies in where from creation menu to user mainmenu it works, but after mainmenu to other widgets such as options, shops and inventory it get’s to none. But I don’t know how to do this someone help me!

Anyone know a way to solve this?

you can store your global variables in game instance.
game instance will not destroy when open level.

you can create your own GameInstance class, remember to change setting to use your own GameInstance class.

Thank you for your reply!!!

Would it also work, when there is a new user, and it creates a new username and password? Does it destroy the old user data or would it keep the old user data and create new user data? I’m sorry, if you didn’t get my explanation.

In my game instance I have username and made it editable. SO in my user Creation menu it saves the username and user password to game-instance. To recall/ load information to other widget User main menu, I’m a bit lost, I know I have to cast it to my game-instance (SAVE THE GAME) but from there I’m a bit confused. Would you mind helping me?

you can load from save object, or just read from Game Instance.

Remember set the variables to Game Instance before close widget,

then on the other widget construct,you can read the value from game instance object.

For cast to game instance I don’t know what to plug for object. Since my function is get Username and the return value is set to text and it has to be an object to be connected to the casting node. Also if I plug “Get game instance node” then it says it would always fail.

My get username function.

I’m a bit confused on what to plug in for the object node in the cast game instance.

Can someone please help me with casting?