Entering and exiting buildings

so, i have created a simple script for entering and exiting buildings, however, it doesnt seem to be holding my boolean values so that it alternates between going indoors and outdoors

as when i spawn indoors, and try to leave the building, it just respawns me in doors, thanks for your help

Hi Juxt4posed,

You are losing the data in the variables because when you directly load another level, everything loads back in from scratch. So it basically just resets everything. There are certain classes like GameMode that can store certain information between levels but I’m not sure why you would need the info you are storing. You should be able to know if you are indoors or outdoors based off of the level itself and then set it accordingly.

You could also avoid the reset by using Streaming Levels. You may want to take a look and see if it would fit your project.

Cheers,

TJ