StateMachine to save states between scenes