private void OnJoystickAppears(int joystickID) { Debug.Log("new joystick connected:"); if (nHumanoids > maxJoysticks) { return; } HumanoidControl humanoid = SpawnHumanoid(); if (humanoid == null) { return; } humanoid.gameControllerEnabled = true; HumanoidControl.SetControllerID(humanoid, joystickID); spawnedHumanoids[joystickID] = humanoid; joystickAssignment[joystickID] = joystickID; nHumanoids++; }