Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Passing Variables to a Character Who isn't Visible Yet.

I'm trying to implement two systems within UMG.

These two systems are :

  • Hat selection.

  • Difficulty level.

Hat selection allows the player to choose a specific hat for the character to wear by choosing it in the main menu.

Difficulty works the same way.

The way I am planning on handling the changes are using simple "ChangeOnInt"

Having the player select No Hat in the menu, for example, would set the Integer "HatSelection" to 0.

The player blueprint would have a "ChangeOnInt" that reads "HatSelection" and sets the hat mesh accordingly.

  • 0 = none

  • 1 = adventurer's hat

  • Etc.

Difficulty would work a similar way.

Normally I pass data between blueprints via casting, however, this time that is not possible, as I wish to allow the player to choose these in the main menu, before any level / the player has loaded.

Any help would be greatly appreciated. I've read up on Blueprint Interfaces and other ways but can never get it to work correctly.

Product Version: Not Selected
more ▼

asked Nov 18 '14 at 10:45 PM in Blueprint Scripting

avatar image

434 40 40 46

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

There are classes that stay alive between level changes. For example the GameInstance. I guess you could set the Hat Enum there and after you startet the game you get it back from the GameInstance and Spawn the Mesh for the player. You can also use a savegame.

more ▼

answered Nov 19 '14 at 11:44 AM

avatar image

6.9k 333 186 472

avatar image Kenomica Nov 19 '14 at 11:54 AM

Thanks, I've looked in to GameState and GameInstance but I have no idea how to add variables to them or call them in blueprints.

I've done a lot of research but documentation on this is very sparse.

avatar image eXi Nov 19 '14 at 12:52 PM

That should be pretty easy. Create a new Blueprint and search for "GameInstance" as parent class. Now go into the Project Settings where you normaly set the Standard CharacterBP and so on, and at the bottom you find this:


I already created a BP of the GameInstance class as you see "MyGameInstance". Inside that BP i created a Bool Variable called "Test".

Now inside my CharacterBP i just rightclicked and searched for "Game Instance". I found the node "Get Game Instance". After casting this to my custom Game Instance Class BP, i was able to get the Test Bool.


And as far as i know, this GameInstance stays alive as long as the game is on. It will be the same over LevelChanges etc. So you could save a variable for the GameTime there. If you also want to save a Variable if the player closes the game, you would need to use SaveGames.

avatar image Kenomica Nov 19 '14 at 01:07 PM

Thank you! That's perfect!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I've struggled with this quite a bit as well.

Most online games use their database for this and since unreal doesn't really have anything reliant which will stay the same over different character, controller, game modes and level the next best thing I found was a save game.

The performance of this node is incredible and it works pretty much like a normal BP in terms of setting and getting variables. You just have to load it first.

I'm on my mobile right now so I can't really link a few nice tutorial videos like I'd want to but I will try to do so later today :)

more ▼

answered Nov 19 '14 at 11:39 AM

avatar image

6k 291 86 293

avatar image Kenomica Nov 19 '14 at 11:42 AM

Thank you. I really appreciate it. I'll also do some research in to save games in Unreal in the mean time :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question