API ReferenceecsdefineState()onExit()On this pageonExit() ecs.defineState(name).onExit(callback) Description Set a callback to run when exiting this state. Parameters PropertyTypeDescriptioncallbackfunctiona callback function to run before state exiting