Skip to content
This repository has been archived by the owner on Jan 5, 2022. It is now read-only.

GetNumPluggedCtrlrs

Jibran Syed edited this page May 27, 2014 · 2 revisions

<- Back to Coding References

Signature

static int GetNumPluggedCtrlrs();

Description

GetNumPluggedCtrlrs() returns the number of Xbox controllers plugged into the computer. If on Windows, XInput's record keeping is used to look for connected Xbox controllers. On other platforms, XCI counts joysticks that have "Xbox", "XBOX", or "Microsoft" in its name.

Example

using UnityEngine;
using XboxCtrlrInput;

public class Example : MonoBehavior
{
    void Start()
    {
        int numOfCtrlrs = XCI.GetNumPluggedCtrlrs();
        Debug.Log("There are " + numOfCtrlrs + " Xbox controllers plugged in.");
    }
}

<- Back to Coding References

Clone this wiki locally