Add a variable to store last state active state when toggling global immersive. Thanks David96 for the idea.