I have one Xbox controller and a generic one. The former works fine, but the latter is not detected half the time. It seems like it starts and stop working at random (not while the game is on, it just either detects it at the beginning or it doesn't).
This is the code in my Async System event:
My Xbox one's ID is 0 and the generic one's is 4.
Any ideas?
This is the code in my Async System event:
Code:
//Gamepad
var type = async_load[? "event_type"];
var _gp = async_load[? "pad_index"];
//Connected
if (type=="gamepad discovered"){
global.gp[gpCount++] = _gp;
log("Gamepad connected: " + string(_gp));
if (global.gp_main < 0){
global.gp_main = _gp;
}
}
//Disconnected
else if (type=="gamepad lost"){
//Remove main
if (global.gp_main == _gp) global.gp_main = -1;
//Remove gp
for(var i=0; i<gpCount; i++){
if (global.gp[i] == _gp){
global.gp[i] = -1;
}
}
}
Any ideas?