Greetings,
I am developing for HoloLens and I need to use using Windows.Devices.Bluetooth
so I added #if WINDOWS_UWP but all of my code under this directive is greyed out in Visual Studio, even though I switched to Universal Windows Platform in the Build Settings.
#if UNITY_WSA_10_0 isn’t greyed out but it doesn’t include the Windows.Devices namespace.
Unity 2019.4.6f1
Visual Studio Community 2019 16.6.4
Any help would be appreciated.
You should use “#if UNITY_WSA && ENABLE_WINMD_SUPPORT” define for using Windows Runtime namespaces.
This does not work. #if WINDOWS_UWP used to work fine for me up until 2020.2. It’s even in the docs still. Where is this change to “#if UNITY_WSA && ENABLE_WINMD_SUPPORT” documented?
Removing “WINDOWS_UWP” just like that would be quite the breaking change.
I can confirm now it still works. I hadn’t checked the “Player Projects” checkbox in the external tools settings. When targeting UWP it’s important to switch to the player project so WINDOWS_UWP can work.