Version: 2019.2
AppCallbacks 클래스
유니버설 Windows 플레이어 설정

유니버설 Windows 플랫폼: C# 스크립트의 WinRT API

Unity 스크립트에서 직접 WinRT API를 사용할 수 있습니다만, 아래의 제약과 요구 사항이 따릅니다.

  • 스크립트는 C#으로 작성해야 합니다.
  • API 호환성 레벨은 플레이어 설정에서 .NET 4.6 또는 .NET 스탠다드 2.0으로 설정해야 합니다.
  • 항상 Mono를 사용하는 Unity 에디터가 동일한 스크립트 코드를 사용하므로, WinRT API를 사용하는 모든 코드는 ENABLE_WINMD_SUPPORT 정의 아래 있어야 합니다.

아래는 WinRT API를 직접 사용하여 광고를 표시하는 예제입니다.

using UnityEngine;
public class WinRTAPI : MonoBehaviour 
{
    void Update() 
    {
        auto adId = GetAdvertisingId();
        // ...
    }

    string GetAdvertisingId() 
    {
        #if ENABLE_WINMD_SUPPORT
            return Windows.System.UserProfile.AdvertisingManager.AdvertisingId;
        #else
            return "";
        #endif
    }
}
AppCallbacks 클래스
유니버설 Windows 플레이어 설정
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961