I have just updated Unity IAP to the latest version released yesterday on the Unity Asset Store, but once the guided installation is complete I cannot install the IAP Catalog, and in the console I continuously receive the following error message: Code (CSharp): UnityException: get_unityVersion is not allowed to be called from a ScriptableObject constructor (or instance field initializer), call it in OnEnable instead. Called from ScriptableObject 'ProductCatalogEditor'. See "Script Serialization" page in the Unity Manual for further details. UnityEditor.Purchasing.UdpSynchronizationApi.CheckUdpAvailability () (at <8d2d05e7bd5745cca0a5537a3fd6f38c>:0) In addition, purchases in apps on iOS devices (version 13.1.3) do not work properly. I need help because I can't publish my game. I use the latest stable version of Unity 2019.2.9f.
Hello, I'm experiencing the same situation. I updated IAP to 1.23.0 via services window. I observe these behaviors: * If I start game while iap catalog window is open, I get the error message* repetitively (~200 / sec). But game and iap system run fine. When I stop game error messages continues, and when I close iap catalog window error messages stop. Similar error messages are also issued 1 or 2 times, see attached screenshot. * If I start game while iap catalog window is closed, I don't get any error message and everything runs fine. Opening iap catalog window and/or stopping game don't cause any error message. I tried removing/reinstallig/reimporting UnityPurchasing and UDP plugins, disabling/enabling IAP via services window, uninstalling in app purchasing package (2.0.6) via package manager (but it got reinstalled by iap installer), several trial-errors over iap installer and iap updater. For now, I'm working without playing the game while iap catalog window open. Any help on finding a cause or a fix is appreciated. (Unity 2019.2.2, windows 10) * The error message: UnityException: get_unityVersion is not allowed to be called from a ScriptableObject constructor (or instance field initializer), call it in OnEnable instead. Called from ScriptableObject 'ProductCatalogEditor'. See "Script Serialization" page in the Unity Manual for further details. UnityEditor.Purchasing.UdpSynchronizationApi.CheckUdpAvailability () (at <97020ad831c24ecbaad86b2f4fbca9f8>:0) UnityEditor.Purchasing.ProductCatalogEditor..cctor () (at <97020ad831c24ecbaad86b2f4fbca9f8>:0) Rethrow as TypeInitializationException: The type initializer for 'UnityEditor.Purchasing.ProductCatalogEditor' threw an exception. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0) UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:359) UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:353) UnityEditor.HostView.SendUpdate () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:465) UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:303)
Yes, I can reproduce and will let the team know. In the meantime, you can safely play your game with the catalog window closed.
For now, you would want to close the Catalog window before you play your game. You only need it open when you first enter your products. After that, you can keep it closed. It is not necessary to keep the Catalog window open while you run your game in the Editor. We will try to address this in an upcoming release.
For anyone encountering this - and the error persists even after the window has been closed, you will find you cannot close the window and restarting unity will not fix the error. If you're basically in this error-spamming hellscape, goto Window --> Layouts --> Reset Factory settings, and that will quieten the error.
Well, I am pretty disappointed with the Unity moderators. This is a re-occurring bug and is very problematic. To just tell us to "Follow the work-around" and then just ignore the issue for months is not how I would expect a professional agile software company to behave. In my case after I had opened the catalog window and closed it, the errors appeared (had thousands after 30 seconds), nothing would work, could not build and could not re-open the catalog at any point. I thought it was my scripts so I disabled every single one and nothing changed! This bug should be fixed as a priority otherwise Unity is going to frustrate and lose customers. Thanks to @jtbentley I have been able to make some progress. Yours is the only solution that worked for me. Was struggling with this for days! Hope there are no more issues.
It sounds like you have a different problem. The problem described here only happens when you run the game with the catalog window open. You only need to have the catalog open once, when you first define your products (or edit them later). Then you close the window, and run your game with no errors. If you are still seeing errors after closing the window, then please show a screenshot here.
Thanks for the reply Jeff, Since I followed @jtbentley suggestion I have not seen the issue re-occur so far. If it does I will post a screen shot.
It's not related to Unity version, it's IAP. Do you see the error after closing the catalog window and resetting the window layout?
IAP Catalog always fails!!! Please help! When I restart Unity (version 2019.2.14f1) I can open IAP Catalog tab (menu Window->Unity IAP->IAP Catalog). But! I dock this tab near Inspector tab. When I launch my project in unity I get 3 identically errors: UnityException: get_unityVersion is not allowed to be called from a ScriptableObject constructor (or instance field initializer), call it in OnEnable instead. Called from ScriptableObject 'ProductCatalogEditor'. See "Script Serialization" page in the Unity Manual for further details. UnityEditor.Purchasing.UdpSynchronizationApi.CheckUdpAvailability () (at <5432628c240348a2818fdcf82b6b6906>:0) UnityEditor.Purchasing.ProductCatalogEditor..cctor () (at <5432628c240348a2818fdcf82b6b6906>:0) Rethrow as TypeInitializationException: The type initializer for 'UnityEditor.Purchasing.ProductCatalogEditor' threw an exception. This error don't crash my project. But after that i can't switch to the IAP Catalog tab! In the console I get endless errors: UnityException: get_unityVersion is not allowed to be called from a ScriptableObject constructor (or instance field initializer), call it in OnEnable instead. Called from ScriptableObject 'ProductCatalogEditor'. See "Script Serialization" page in the Unity Manual for further details. UnityEditor.Purchasing.UdpSynchronizationApi.CheckUdpAvailability () (at <5432628c240348a2818fdcf82b6b6906>:0) UnityEditor.Purchasing.ProductCatalogEditor..cctor () (at <5432628c240348a2818fdcf82b6b6906>:0) Rethrow as TypeInitializationException: The type initializer for 'UnityEditor.Purchasing.ProductCatalogEditor' threw an exception. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <567df3e0919241ba98db88bec4c6696f>:0) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <567df3e0919241ba98db88bec4c6696f>:0) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <567df3e0919241ba98db88bec4c6696f>:0) UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:359) UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:353) UnityEditor.HostView.SendUpdate () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:465) UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:303) while don't close IAP Catalog tab or switch to another tab. I can no longer open it from the menu. I get the error: UnityException: get_unityVersion is not allowed to be called from a ScriptableObject constructor (or instance field initializer), call it in OnEnable instead. Called from ScriptableObject 'ProductCatalogEditor'. See "Script Serialization" page in the Unity Manual for further details. UnityEditor.Purchasing.UdpSynchronizationApi.CheckUdpAvailability () (at <5432628c240348a2818fdcf82b6b6906>:0) UnityEditor.Purchasing.ProductCatalogEditor..cctor () (at <5432628c240348a2818fdcf82b6b6906>:0) Rethrow as TypeInitializationException: The type initializer for 'UnityEditor.Purchasing.ProductCatalogEditor' threw an exception. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <567df3e0919241ba98db88bec4c6696f>:0) Restart Unity helps.But everything starts over again!!!
Please provide specific steps to reproduce on a new project. Does it work correctly if you close the Catalog window after you're done entering your products?