question

Ivan avatar image
Ivan asked

Error while loading Intesrtitial

Hello! I try to integrate Amazon Ads into Unity project (Unity version 5.3.1f) Here is my code: void Start() { key.StringValue = "appp_key_here"; shouldEnable.BooleanValue = true; mobileAds.SetApplicationKey(key); mobileAds.EnableLogging(shouldEnable); mobileAds.EnableTesting(shouldEnable); //Optional mobileAds.EnableGeoLocation(shouldEnable); } void Update() { if (Input.GetKeyDown(KeyCode.Escape)) Application.Quit(); } void OnGUI() { //Create a new slot for interstitial if (GUI.Button(new Rect(20, 40, 180, 40), "Create Intersetial Ads")) { Ad interstialAd = mobileAds.CreateInterstitialAd(); string adType = interstialAd.AdType.ToString(); long identifier = interstialAd.Identifier; Debug.Log(identifier + " " + adType); } // Load interstitial if (GUI.Button(new Rect(20, 100, 180, 40), "Load Intersetial Ads")) { LoadingStarted response = mobileAds.LoadInterstitialAd(); bool loadingStarted = response.BooleanValue; Debug.Log(loadingStarted); } // Display interstitial if (GUI.Button(new Rect(20, 160, 180, 40), "Show Intersetial Ads")) { AdShown shownInterstitialAd = mobileAds.ShowInterstitialAd(); bool adShown = shownInterstitialAd.BooleanValue; Debug.Log("adShown: " + adShown); } } Here is logcat I/Unity ( 4888): AmazonMobileAdsUnityAndroid: Successfully called native code in 10 ms I/Unity ( 4888): I/Unity ( 4888): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe bugBindings.gen.cpp Line: 65) I/Unity ( 4888): I/Unity ( 4888): AmazonMobileAdsUnityAndroid: Successfully called native code in 6 ms I/Unity ( 4888): I/Unity ( 4888): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe bugBindings.gen.cpp Line: 65) I/Unity ( 4888): I/Unity ( 4888): AmazonMobileAdsUnityAndroid: Successfully called native code in 15 ms I/Unity ( 4888): I/Unity ( 4888): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe bugBindings.gen.cpp Line: 65) I/Unity ( 4888): I/Unity ( 4888): AmazonMobileAdsUnityAndroid: Successfully called native code in 23 ms I/Unity ( 4888): I/Unity ( 4888): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe bugBindings.gen.cpp Line: 65) I/Unity ( 4888): I/Unity ( 4888): 1 INTERSTITIAL I/Unity ( 4888): I/Unity ( 4888): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe bugBindings.gen.cpp Line: 65) I/Unity ( 4888): I/Unity ( 4888): AmazonMobileAdsUnityAndroid: Successfully called native code in 48 ms I/Unity ( 4888): I/Unity ( 4888): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe bugBindings.gen.cpp Line: 65) I/Unity ( 4888): I/Unity ( 4888): True I/Unity ( 4888): I/Unity ( 4888): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe bugBindings.gen.cpp Line: 65) I/Unity ( 4888): I/Unity ( 4888): AmazonMobileAdsUnityAndroid: eventReceived I/Unity ( 4888): I/Unity ( 4888): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe bugBindings.gen.cpp Line: 65) I/Unity ( 4888): I/Unity ( 4888): KeyNotFoundException: The given key was not present in the di ctionary. I/Unity ( 4888): at System.Collections.Generic.Dictionary`2[System.String,Sy stem.Collections.Generic.List`1[com.amazon.mas.cpt.ads.IDelegator]].get_Item (Sy stem.String key) [0x00000] in :0 I/Unity ( 4888): at com.amazon.mas.cpt.ads.AmazonMobileAdsImpl.FireEvent (Sy stem.String jsonMessage) [0x00000] in :0 I/Unity ( 4888): at com.amazon.mas.cpt.ads.AmazonMobileAdsImpl+AmazonMobileA dsBase.UnityFireEvent (System.String jsonMessage) [0x00000] in :0 For what reason I get error KeyNotFoundException: The given key was not present in the dictionary? Thanks!
mobile ads
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Ivan avatar image
Ivan answered
Any ideas?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Ross@Amazon avatar image
Ross@Amazon answered
This reappears to be an error with Unity and not Amazon Mobile Ads. There are several possible solutions included on the Unity 3D forums: http://answers.unity3d.com/search.html?f=&type=question&redirect=search%2Fsearch&sort=relevance&q=KeyNotFoundException.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.