Community Q&A

Welcome to Audiokinetic’s community-driven Q&A forum. This is the place where Wwise and Strata users help each other out. For direct help from our team, please use the Support Tickets page. To report a bug, use the Bug Report option in the Audiokinetic Launcher. (Note that Bug Reports submitted to the Q&A forum will be rejected. Using our dedicated Bug Report system ensures your report is seen by the right people and has the best chance of being fixed.)

To get the best answers quickly, follow these tips when posting a question:

  • Be Specific: What are you trying to achieve, or what specific issue are you running into?
  • Include Key Details: Include details like your Wwise and game engine versions, operating system, etc.
  • Explain What You've Tried: Let others know what troubleshooting steps you've already taken.
  • Focus on the Facts: Describe the technical facts of your issue. Focusing on the problem helps others find a solution quickly.

+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.
in General Discussion by 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 Answers

+1 vote
hello, have you fix this? We have this issue too.
by 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
by J C. (190 points)
...