Issue Checklist
Platform
Compiled from GitHub Source Code
Browser
None
Version
0.5.2
Description (include any images, videos, errors, or crash logs)
in Module.hx...
/**
* Called when a module is destroyed.
* This currently only happens when reloading modules with F5.
*/
public function onDestroy(event:ScriptEvent) {}
but in PlayState.hx...
/**
* Perform necessary cleanup before leaving the PlayState.
*/
function performCleanup():Void
{
// If the camera is being tweened, stop it.
cancelAllCameraTweens();
// Dispatch the destroy event.
dispatchEvent(new ScriptEvent(DESTROY, false));
im assuming this is unintentional...
maybe these events should be unique to each other? it's been a bit of a hassle figuring out how to prevent what would be unrelated cleanup code from running when playstate is destroyed
currently im just doing this:
private var pressedReload:Bool = false; // just in case theres a single frame delay
override public function onUpdate(event:UpdateScriptEvent):Void {
pressedReload = FlxG.keys.justPressed.F5;
}
override public function onDestroy(event:ScriptEvent):Void {
if (
(PlayState.instance != null && PlayState.instance.criticalFailure) ||
(!FlxG.keys.justPressed.F5 && !pressedReload)
) {
return; // is not reloading
}
// reloading
}
Steps to Reproduce
trace during onDestroy in a module, it should show up in console when PlayState is destroyed as well as mod reload
Issue Checklist
Platform
Compiled from GitHub Source Code
Browser
None
Version
0.5.2
Description (include any images, videos, errors, or crash logs)
in
Module.hx...but in
PlayState.hx...im assuming this is unintentional...
maybe these events should be unique to each other? it's been a bit of a hassle figuring out how to prevent what would be unrelated cleanup code from running when playstate is destroyed
currently im just doing this:
Steps to Reproduce
traceduringonDestroyin a module, it should show up in console whenPlayStateis destroyed as well as mod reload