Do Variables reset

So I’ve got 2 levels in my 2d game so far and I using a variable to keep track of the level number that the player is on. But every time I load a new level it looks like the variable resets, is this that is going on or am I missing some other thing in my blueprint?


If you’re changing levels (ie not using level streams), then much of the persistent data is lost.

If you want to preserve data across levels, you’ll likely want to store it in the GameInstance class. (GameInstance is preserved across levels)

So I used the cast to GameInstance but I get this error:

Warning ‘2d Game Instance’ does not inherit from ‘Actor’ ( Cast To 2dGameInstance would always fail).

This might help.

Thank you both, just what I needed :slight_smile: