Detecting Game Controller at the Start of the Game

I am trying to detect when a game controller is being used at the start of the game. If the game controller is plugged in after the game has started, the code works. But if the game controller is plugged in before the game has started, the code does not work.

I am using the Async - System

The Async -System does not seemed to be called when the game starts.

How do I get Async- System call to happen at the Start of the game?

The Code Looks like this

------

switch(async_load[? "event_type"]) {

case "gamepad discovered":

global.pad = async\_load\[? "pad\_index"\];

gamepad\_set\_axis\_deadzone(global.pad, deadzone);

gamepad\_set\_button\_threshold(global.pad, threshhold);



global.controllerPluggedIn = true;

s\_set\_gamepad();

break;

case "gamepad lost":

global.pad = async_load[? "pad_index"];

global.controllerPluggedIn = false;

s\_set\_gamepad();

break;

}
 

curato

Member
Yeah I would recommend having a manager object that is persistent from the beginning of the game to keep track of the gamepads.
 
Top