AudiokineticのコミュニティQ&AはWwiseやStrataのコミュニティ内でユーザ同士が質問・回答をし合うことができるフォーラムです。Audiokineticテクニカルサポートチームからの回答をご希望の場合は、必ず サポートチケットページ をご利用ください。

Bug Report: 2017.2.0 Unity integration: exception in AutoObject Finalizer

+1 支持
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.
Maksym H. (120 ポイント) 2018 2/8 質問 General Discussion
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)

回答 1

0 支持
hello, have you fix this? We have this issue too.
Jianyong L. (140 ポイント) 2019 4/14 回答
Hi! Did you find a fix for this issue? We have it aw :/ Thanks!
...