DaVikingCode/UnityDetectHeadset

CanDetect()

Closed this issue · 0 comments

Works great, thank you so much!

Just a note, for the user-exposed debug status text of my crossdevice app, I needed a type of "CanDetect()" to show one of the three values Headphones: Unknown/ Yes/ No (and not just Yes/ No), so I added to your class this:

static public bool CanDetect()
{
    bool can = false;
    #if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR
        can = true;
    #endif
    return can;
}

(I suppose an alternative would have been to turn Detect() into a nullable bool.)