Esempio n. 1
0
    public static void InitializeSdk()
    {
        if (initialized)
        {
            Debug.LogWarning("[Yodo1 Ads] The SDK has been initialized, please do not initialize the SDK repeatedly.");
            return;
        }

        var type   = typeof(Yodo1U3dSDK);
        var sdkObj = new GameObject("Yodo1U3dSDK", type).GetComponent <Yodo1U3dSDK>(); // Its Awake() method sets Instance.

        if (Yodo1U3dSDK.Instance != sdkObj)
        {
            Debug.LogError("[Yodo1 Ads] It looks like you have the " + type.Name + " on a GameObject in your scene. Please remove the script from your scene.");
            return;
        }

        Yodo1Ads.Yodo1AdSettings settings = Resources.Load("Yodo1Ads/Yodo1AdSettings", typeof(Yodo1Ads.Yodo1AdSettings)) as Yodo1Ads.Yodo1AdSettings;
        if (settings == null)
        {
            Debug.LogError("[Yodo1 Ads] The SDK has not been initialized yet. The Yodo1AdSettings is missing.");
            return;
        }

        string appKey = string.Empty;

#if UNITY_ANDROID
        appKey = settings.androidSettings.AppKey;
#elif UNITY_IOS
        appKey = settings.iOSSettings.AppKey;
#endif
        Debug.Log("[Yodo1 Ads] The SDK has been initialized, the app key is " + appKey);
        Yodo1U3dAds.InitWithAppKey(appKey);

        initialized = true;
    }