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"

How to keep a timer ticking between different levels ?

I built a system that counts time. With this system I can set the number of seconds in a minute, the number of minutes in an hour, the number of hours in a day and so on... My question is, how would I go about keeping my time system ticking between different levels ?

Currently my time system is built in the level blueprint but that's where I encounter my problem. To my knowledge, there's no way too use the same level blueprint for multiple levels, so I would need to rebuild my time system in every level I create and that's inefficient.

I explored different possibilities in my head like building the time system in a gamemode blueprint and storing the time variables in a game instance blueprint when I load a new level and loading those variables once the next level loads.

What I want is to keep the variables (circled in the picture) across the levels and feed them to another time system in another level so they can keep ticking seamlessly. I need a bit of insight from fellow programmers :p.alt text Best regards. Wes

Product Version: UE 4.18
timemachine.jpg (117.6 kB)
more ▼

asked Nov 10 '17 at 09:50 PM in Blueprint Scripting

avatar image

8 1 2

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

2 answers: sort voted first

if you want timer to continue counting as soon as the new level is loaded you must use game instance to store the last count in it because game instance is the only object which stays alive and wont get reset when loading a new level.

i think you can also set your timer inside game instance.

or you can save information about timer and read from disk as soon the new level is loaded.

after you created a custom game instance you must set ii as project game instance from project settings

more ▼

answered Nov 10 '17 at 10:39 PM

avatar image

2.4k 73 43 108

avatar image PR3STONE Nov 11 '17 at 05:57 PM

Thanks for the insight saeedc, I appreciate you taking the time to answer. I'll try out your suggestions and see which one suits me best. Cheers !

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

You can set that variables on your game instance, that should be the same in all of your levels.

Anyway, why dont you use "UTCNow" time node? You can get seconds, minutes, hours, days, months and years from there, and store each one of that variables (or a diference between now and the first moment you want to start to count) and update it when you need.

more ▼

answered Nov 10 '17 at 10:43 PM

avatar image

184 18 21 34

(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