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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to save a variable ?

Hello to finalize my project I need to recover the time of the level Map that is displayed through the Widget Class HUB. Once recovered I have to display it in the second level FinMenuLevel in the Class Widget FinMenuWidget. Since I change the level the variable is erased. Do you have a solution to save or recover the variable?

Product Version: UE 4.21
Tags:
capture4.png (21.2 kB)
capture3.png (130.3 kB)
capture2.png (163.5 kB)
capture1.png (155.3 kB)
more ▼

asked Feb 18 '19 at 10:04 PM in Blueprint Scripting

avatar image

TheKingofFluff
5 1 1 3

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

1 answer: sort voted first

In Project Settings "Project - Maps and Modes" you can create a new GameInstance class. The GameInstance persists between levels until you quit the game.

more ▼

answered Feb 18 '19 at 10:25 PM

avatar image

GarnerP57
816 3 4 8

avatar image TheKingofFluff Feb 18 '19 at 10:51 PM

Thanks, I looked at the tutorial to try to better understand https://www.youtube.com/watch?v=5w594D3qtLs but I still can not do a getInstance -> Cast to GameInstanceRunner -> Timer. Can you teach me how to do?

To make my stopwatch I made the same one: https://www.youtube.com/watch?v=95CMPGQAS-Y

avatar image GarnerP57 Feb 18 '19 at 11:07 PM

Your custom GameInstance class has to be set in the Project Settings under Maps and Modes (Game Instance Class) then you should be able to get the GameInstance at any time.

avatar image TheKingofFluff Feb 19 '19 at 12:00 AM

I understand the use of the GameInstance, but I can not stop my timer and get it back to the next level.

avatar image GarnerP57 Feb 19 '19 at 02:15 AM

Using a timeline to make a stopwatch is overkill anyway and not the purpose of a timeline. You should use a "SetTimerByEvent" or "SetTimerByFunctionName" and have it looping every second and you will have exactly the same behavior. When you want the Timer to stop you simply call "SetTimerByEvent" again but with a time of 0.0 and it will stop.

(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