File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,6 +23,11 @@ private class GraphicNapeDebug extends BitmapData {}
2323 */
2424class FlxNapeSpace extends FlxBasic
2525{
26+ /**
27+ * The instance of the global FlxNapeSpace plugin, created when calling init()
28+ */
29+ public static var instance : FlxNapeSpace ;
30+
2631 public static var space : Space ;
2732
2833 /**
@@ -64,10 +69,19 @@ class FlxNapeSpace extends FlxBasic
6469 */
6570 public static function init (): Void
6671 {
72+ if (instance != null )
73+ {
74+ FlxG .plugins .remove (instance );
75+ instance .destroy ();
76+ instance = null ;
77+ }
78+
79+ instance = new FlxNapeSpace ();
80+
6781 #if (flixel < version("5.6.0"))
68- FlxG .plugins .add (new FlxNapeSpace () );
82+ FlxG .plugins .add (instance );
6983 #else
70- FlxG .plugins .addPlugin (new FlxNapeSpace () );
84+ FlxG .plugins .addPlugin (instance );
7185 #end
7286
7387 if (space == null )
You can’t perform that action at this time.
0 commit comments