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"

Reset level but not reset variables

I'm having the same issue as this thread https://answers.unrealengine.com/questions/214804/restart-level-but-not-reset-a-variable.html but I've been unable to solve it. After reading the comments I moved the variable into a custom Game State. Essentially, to test this, what I'm doing is a quick sequence.

1) On begin Play, casting to the game state, then running through a Branch comparing an INT that's defaulted to zero, and then printing a string if it's zero. 2) I'm adding 1 to the INT.

On Exec Command: RestartLevel - the printed string will trigger every time. It won't go up to 2, 3, or 4 - it'll just print the string and add 1 to the Int, then default back to 0 to do it all again.

Essentially, I want to be able to dive back into the gameplay without playing my starting UMG sequence again, but... i'm probably going to want to keep track of variables for the long haul - like total times played, etc. Am I going about this the wrong way?

Some threads said there was a bug that was addressed in 4.8, but this seems more like a logic mistake than some sort of bug. I've also tried moving the variable into the Game Mode and still not luck.

Product Version: UE 4.8
more ▼

asked Jul 21 '15 at 04:22 PM in Blueprint Scripting

avatar image

121 3 11 17

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

1 answer: sort voted first

Game Instance - persists through level reloads etc. survives until game close, at which point you'd save the data using the standard savegame method in the wiki.

more ▼

answered Jul 22 '15 at 05:39 AM

avatar image

986 34 3 41

avatar image RAVaught Jul 22 '15 at 06:31 AM

If you are saving games for reload (save file) then you could also save at death and reload upon death. It may consume a little time, but on the plus side, if the game crashes at respawn all the player data is already saved.

avatar image Maceo_P_King Jul 22 '15 at 07:48 PM

yeah, that was it. I found some awesome game instance stuff here https://www.youtube.com/watch?v=K_4CWDxwufg

and then, once i realized i had to go into project settings to turn it on, that was pretty good. Still haven't messed w/ save files, but I guess that's next. It's well documented so... yeah, time to dig in! :)

Thanks again! :)

(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