Reference an object from another level

Hi. Here is the situation. My game has two levels : one for the start screen, one for the game. The game has a timer : if you don’t finish under 5 minutes you lose. I would like to create an “exploration mode” that removes the timer. I had the idea of creating a check box in the start menu. When checked, it should change the timer to exploration mode and disable it. However, the timer and UI are in two different levels, so I can’t access the timer via the widget. Is there a way to do what I want ?

Create a variable in your GameMode, called ExploreMode (boolean). When you change the checkbox, you update the ExploreMode variable to match. In your game, do a bool check before running the timer, eg If GameMode->ExploreMode is TRUE, dont use the timer.

Not in the GameMode… Since it can change during loading anew level.

Better use the GameInstance for that, since it persistent from Game Start to Shutdown.

1 Like