-
Notifications
You must be signed in to change notification settings - Fork 43
Description
Hi team,
I'm encountering a critical error when using the Huawei Plugin in Unity 6. The error seems to be a combination of a serialization layout mismatch and an attempt to create ScriptableObjects during runtime, leading to a Failed to load the HMSAdsKitSettings exception.
Here are the details from the Unity console:
A scripted object (script unknown or not yet loaded) has a different serialization layout when loading. (Read 52 bytes but expected 144 bytes)
Did you #if UNITY_EDITOR a section of your serialized properties in any of your scripts?
UnityEngine.ResourcesAPIInternal:Load(String, Type)
UnityEngine.Resources:Load(String)
HmsPlugin.ScriptableHelper:Load(String, String)
HmsPlugin.HMSAdsKitSettings:.ctor()
System.Reflection.RuntimeConstructorInfo:InternalInvoke(Object, Object[], Boolean)
System.Activator:CreateInstance()
HmsPlugin.HMSEditorSingleton1:get_Instance()
HmsPlugin.HMSAdsKitManager:.ctor(Boolean)
System.Reflection.RuntimeConstructorInfo:InternalInvoke(Object, Object[], Boolean)
System.Activator:CreateInstance()
System.Lazy1:ViaFactory(LazyThreadSafetyMode)
System.Lazy1:ExecutionAndPublication(LazyHelper, Boolean)
System.Lazy1:CreateValue()
GDPRController:RequestGdprStatus()
[ line 1693525176]
2025-06-19 14:24:17.516 18332-19264 Unity usap64 E Creating ScriptableObjects during runtime is not allowed!
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
HmsPlugin.ScriptableHelper:Create(String, String)
HmsPlugin.HMSAdsKitSettings:.ctor()
System.Reflection.RuntimeConstructorInfo:InternalInvoke(Object, Object[], Boolean)
System.Activator:CreateInstance()
HmsPlugin.HMSEditorSingleton1:get_Instance()
HmsPlugin.HMSAdsKitManager:.ctor(Boolean)
System.Reflection.RuntimeConstructorInfo:InternalInvoke(Object, Object[], Boolean)
System.Activator.CreateInstance()
System.Lazy1:ViaFactory(LazyThreadSafetyMode)
System.Lazy1:ExecutionAndPublication(LazyHelper, Boolean)
System.Lazy1:CreateValue()
GDPRController:RequestGdprStatus()
2025-06-19 14:24:17.519 18332-19264 Unity usap64 E InvalidOperationException: Failed to load the HMSAdsKitSettings. Please restart Unity Editor
at HmsPlugin.HMSAdsKitSettings..ctor () [0x00000] in <00000000000000000000000000000000>:0
at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00000] in <00000000000000000000000000000000>:0
at System.Activator.CreateInstance[T] () [0x00000] in <00000000000000000000000000000000>:0
at HmsPlugin.HMSEditorSingleton1[T].get_Instance () [0x00000] in <00000000000000000000000000000000>:0
at HmsPlugin.HMSAdsKitManager..ctor (System.Boolean hasPurchasedNoAds) [0x00000] in <00000000000000000000000000000000>:0
at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00000] in <00000000000000000000000000000000>:0
at System.Activator.CreateInstance[T] () [0x00000] in <00000000000000000000000000000000>:0
at System.Lazy1[T].ViaFactory (Sys
Unity Version: Unity 6, plugin version 2.3.9.
Steps to Reproduce:
Open a Unity 6 project.
Import the Huawei Plugin 2.3.9.
Build and run the application
Questions:
Is this a known compatibility issue with Unity 6 and the current version of the Huawei Plugin?
The log clearly states Creating ScriptableObjects during runtime is not allowed!. Is there a specific configuration or initialization step we might be missing to ensure HMSAdsKitSettings is properly created as an asset and not attempted to be created at runtime by the plugin?
Are there any specific workarounds or recommended practices for integrating the Huawei Plugin with Unity 6 to avoid these ScriptableObject and serialization issues?
Any guidance or potential solutions would be greatly appreciated. Thank you!