社区问答

欢迎来到 Audiokinetic 社区问答论坛。在此,Wwise 和 Strata 用户可互帮互助。如需我们团队直接提供协助,请前往技术支持申请单页面。若要报告问题,请在 Audiokinetic Launcher 中选择“报告错误”选项(注意,问答论坛并不会接收错误报告)。我们内部设有专门的错误报告系统,会有专人查看报告并设法解决问题。

要想尽快得到满意的解答,请在提问时注意以下几点:

  • 描述尽量具体:比如,想达到什么样的目的,或者具体哪里有问题。
  • 包含关键细节:比如,Wwise 和游戏引擎版本以及所用操作系统等等。
  • 阐明所做努力:阐明自己为了排除故障都采取了哪些措施。
  • 聚焦问题本身:聚焦于问题本身的相关技术细节,以便别人可以快速找到解决方案。

+2 投票
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.
分类:General Discussion | 用户: Maksym H. (130 分)
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 个回答

+1 投票
hello, have you fix this? We have this issue too.
用户: Jianyong L. (160 分)
Hi! Did you find a fix for this issue? We have it aw :/ Thanks!
0 投票
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
用户: J C. (190 分)
...