Я пытаюсь реализовать восстановление покупок для Play Store в Unity 2019.2.21
При попытке в телефоне выдается исключение нулевой ссылки. НО Восстановление РАБОТАЕТ.
Мой код здесь:
public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
{
extensions.GetExtension<IGooglePlayStoreExtensions>().RestoreTransactions(result =>
{
if (result)
{
// This does not mean anything was restored,
// merely that the restoration process succeeded.
PlayerPrefs.SetInt("removeAds", 20);
myAdManager.bannerView.Destroy();
}
else
{
// Restoration failed.
}
});
this.controller = controller;
Debug.Log("OnInitializedStartedNow");
}
В редакторе назначена переменная myAdmanager, инспектор
Журнал ошибок из логики:
2020-03-11 10:55:16.678 16100-16309/? E/Unity: NullReferenceException: Object reference not set to an instance of an object.
at MyStoreClass.<OnInitialized>b__11_0 (System.Boolean result) [0x00000] in <00000000000000000000000000000000>:0
at System.Action`1[T].Invoke (T obj) [0x00000] in <00000000000000000000000000000000>:0
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.AndroidJavaProxy.Invoke (System.String methodName, System.Object[] args) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine._AndroidJNIHelper.InvokeJavaProxyMethod (UnityEngine.AndroidJavaProxy proxy, System.IntPtr jmethodName, System.IntPtr jargs) [0x00000] in <00000000000000000000000000000000>:0
Rethrow as TargetInvocationException: UnityEngine.Purchasing.GooglePlayStoreCallback.OnTransactionsRestored(System.Boolean)
at UnityEngine.Androi
Большое спасибо!