x

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
Tags:
more ▼

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

avatar image

Alpha Cats
119 7 12 26

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

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:

https://docs.unrealengine.com/latest/INT/Gameplay/SaveGame/

and

https://docs.unrealengine.com/latest/INT/Gameplay/SaveGame/Blueprints/index.html

more ▼

answered Oct 25 '16 at 08:19 PM

avatar image

VictorBurgos
2.4k 61 27 113

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

Thanks, much appreciated

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

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

MajinSephiroth
1.2k 31 8 33

(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