menu
 

La section Questions et réponses de la communauté Audiokinetic est un forum où les utilisateurs de Wwise et de Strata peuvent poser des questions et répondre à celles des autres membres de la communauté. Si vous souhaitez obtenir une réponse de la part de l'équipe de soutien technique d'Audiokinetic, veillez à utiliser le formulaire de Tickets de Soutien.

+2 votes
In Unity integration v2017.2 6500 contain some logically invalid code that causes runtime/compile-time exceptions:

Unhandled Exception: System.InvalidOperationException: EnsureRunningOnMainThread can only be called from the main thread
  at (wrapper managed-to-native) UnityEngine.Object:EnsureRunningOnMainThread ()
  at UnityEngine.Object.GetInstanceID () [0x00002] in /build/Runtime/Export/UnityEngineObject.cs:31
  at UnityEngine.Object.IsNativeObjectAlive (UnityEngine.Object o) [0x0003b] in /build/Runtime/Export/UnityEngineObject.cs:134
  at UnityEngine.Object.CompareBaseObjects (UnityEngine.Object lhs, UnityEngine.Object rhs) [0x00025] in /build/Runtime/Export/UnityEngineObject.cs:98
  at UnityEngine.Object.op_Equality (UnityEngine.Object x, UnityEngine.Object y) [0x00003] in /build/Runtime/Export/UnityEngineObject.cs:253
  at AkSoundEngine.InternalGameObjectHash (UnityEngine.GameObject gameObject) [0x00003] in /Client/Assets/Wwise/Deployment/API/Handwritten/AkSoundEngine.cs:62
  at AkSoundEngine.GetAkGameObjectID (UnityEngine.GameObject gameObject) [0x00007] in /Client/Assets/Wwise/Deployment/API/Handwritten/AkSoundEngine.cs:75
  at AkSoundEngine.UnregisterGameObj (UnityEngine.GameObject gameObject) [0x00002] in /Client/Assets/Wwise/Deployment/API/Handwritten/AkSoundEngine.cs:98
  at AkSoundEngine+AutoObject.Finalize () [0x00007] in /Client/Assets/Wwise/Extensions/AkSoundEngine.extensions.cs:23

As you can find this happens because AutoObject attempt to call native methods from GarbageCollection thread, which is not supported by Unity.
Exceptions doesn't show up in unity console (due to GC thread?), but could be seen in log files, or can be catched with try-catch statement in finalizer

We have not investigated all consequences of such behavior, but the most obvious is that resource cleaning doesn't actually happen as designed.
dans General Discussion par Maksym H. (130 points)
We have the same thing. Only happens in Editor play mode when changing scenes. We are using Unity 2018.3.0f2 with Wwise integration 2018.1.5.6835.1288

InvalidOperationException: EnsureRunningOnMainThread can only be called from the main thread
UnityEngine.Object.EnsureRunningOnMainThread () (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.bindings.cs:153)
UnityEngine.Object.GetInstanceID () (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.bindings.cs:73)
UnityEngine.Object.IsNativeObjectAlive (UnityEngine.Object o) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.bindings.cs:182)
UnityEngine.Object.CompareBaseObjects (UnityEngine.Object lhs, UnityEngine.Object rhs) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.bindings.cs:140)
UnityEngine.Object.op_Equality (UnityEngine.Object x, UnityEngine.Object y) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.bindings.cs:403)
AkSoundEngine.InternalGameObjectHash (UnityEngine.GameObject gameObject) (at Assets/Plugins/Wwise/Deployment/API/Handwritten/Common/AkSoundEngine.cs:76)
AkSoundEngine.GetAkGameObjectID (UnityEngine.GameObject gameObject) (at Assets/Plugins/Wwise/Deployment/API/Handwritten/Common/AkSoundEngine.cs:95)
AkSoundEngine.UnregisterGameObj (UnityEngine.GameObject gameObject) (at Assets/Plugins/Wwise/Deployment/API/Handwritten/Common/AkSoundEngine.cs:136)
AkSoundEngine+AutoObject.Finalize () (at Assets/Plugins/Wwise/Extensions/AkSoundEngine.extensions.cs:24)
UnityEngine.UnhandledExceptionHandler:<RegisterUECatcher>m__0(Object, UnhandledExceptionEventArgs)

2 Réponses

+1 vote
hello, have you fix this? We have this issue too.
par Jianyong L. (160 points)
Hi! Did you find a fix for this issue? We have it aw :/ Thanks!
0 votes
we are getting this in editor in 2022.1.15 and it would be good to hear from anyone from AK confirming whether this is potentially a problem for android/ios builds
par J C. (190 points)
...