How to destroy gamepad?

22 views
Skip to first unread message

Ats

unread,
Feb 6, 2015, 7:59:40 AM2/6/15
to haxef...@googlegroups.com
Hi, I have a gamepad declared as:

private var gamepad:FlxGamepad;


After using it, I'm trying to destroy it when I change state with FlxDestroyUtil:

override public function destroy():Void
{
 gamepad
= FlxDestroyUtil.destroy(gamepad);
 super.destroy();
}



That seemed to work, but on OUYA, it just quit the game without warning.
So I replaced it by a simple:

gamepad = null;


Is that it? Do I miss something? And most of all, do I need to destroy the gamepad or not?
Thanks for your help!

Tembac

unread,
Feb 6, 2015, 10:38:37 PM2/6/15
to haxef...@googlegroups.com
I'm not sure but my approach is to do a static var gamepad on the Reg class so I can access the same gamepad on all the states.
Reply all
Reply to author
Forward
0 new messages