Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseIt is possible to use WinRT API directly in Unity scripts. However there are limitations and requirements for this:
Note, that NETFX_CORE is defined by Visual Studio when compiling code for Windows Store Apps, so it can be used in any C# code, not just Unity scripts.
Bellow is an example for getting advertising is using WinRT API directly:
using UnityEngine;
public class WinRTAPI : MonoBehaviour {
void Update() {
auto adId = GetAdvertisingId();
// ...
}
string GetAdvertisingId() {
#if NETFX_CORE
return Windows.System.UserProfile.AdvertisingManager.AdvertisingId;
#else
return "";
#endif
}
}