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"

Store # of lives variable for future game sessions

I'm looking to store a player variable that is the number of lives the character has, how would I store that variable so that in a new game session it still knows how many lives the character has, and can load that variable.

It's a mobile game if that changes anything.

Product Version: UE 4.13
more ▼

asked Oct 25 '16 at 08:13 PM in Blueprint Scripting

avatar image

Alpha Cats
109 7 12 26

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

You use a SaveGame object. And store the variables you want to save there. You then load it on begin play or whenever you want.

Further information can be found here:




more ▼

answered Oct 25 '16 at 08:19 PM

avatar image

2.4k 60 27 111

avatar image Alpha Cats Oct 25 '16 at 08:39 PM

Thanks, much appreciated

(comments are locked)
10|2000 characters needed characters left

If you don't care about keeping track of that variable between closing game and re-opening game, you can use the game instance as storage.

Here's a tutorial on how to use the Game Instance

more ▼

answered Oct 25 '16 at 08:40 PM

avatar image

1.2k 31 8 32

(comments are locked)
10|2000 characters needed characters left
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