Community Q&A

Where Wwise users help each other out!

Audiokinetic's Community Q&A is the forum where Wwise users ask and answer questions within the Wwise community. Contact Sales if your project requires a support plan.

What script does Wwise need Unity to use in order to call a sound from an event?

0 votes

Not sure I'm even asking this right. My programmer knows nothing of Wwise, so it's up to me to integrate it with Unity. I don't know what HE needs to do to make Unity speak to Wwise. I installed the integration package, created a sound, made an event, and generated a soundbank.

Does the Unity script that calls my event need to have the event name in there? I'm assuming that's how it works. What line of code does it need to be, cuz I think that's the problem, my programmer has the wrong "type" of code in there, or whatever. Does this make sense to anyone?

This is the script that calls for sound right now:

void PlayOpenSound(){
              audioSource.Play();

What do I need to do with this?

asked Mar 31, 2015 in General Discussion by Andy B. (220 points)
I checked that folder (it's Android for me), and the bank files are there:

Init.bnk
PluginInfo
SoundbanksInfo
Subverses.bnk

I was taught that the soundbanks path needed to be something like this: Unity/assets/streaming assets/audio/generatedsoundbanks/android/english

has that changed?
You still need to generate the SoundBanks for the Editor platform (if you are running the Mac Unity Editor, generate for Mac, and same for Windows).

The path you gave me is correct, this is there the code will look for them.
THAT DID IT!! Thanks a ton. Can I keep you on retainer? I'm sure I will need more help.

1 Answer

0 votes

The simplest way to play a sound using the integration is to use the Wwise picker and drag & drop SoundBanks and Events to Unity GameObjects. See this tutorial for more information: https://www.youtube.com/watch?v=-VuXKTsG3Uc

If you need to post an event from a script, this is the simplest way to do it:

AkSoundEngine.PostEvent("Footstep", gameObject);

Make sure the SoundBank containing the event is loaded, though!

If you need a more precise answer, feel free to let me know!

answered Mar 31, 2015 by Benoit S. (Audiokinetic) (15,900 points)
I followed that video and ended up with a couple major errors in Unity.

WwiseUnity: Failed load Init.bnk with result: AK_FileNotFound
UnityEngine.Debug:LogError(Object)
AkInitializer:Awake() (at Assets/Wwise/Deployment/Components/AkInitializer.cs:169)

and  

Wwise: Bank Subverses failed to load (AK_FileNotFound)
UnityEngine.Debug:LogWarning(Object)
AkBankHandle:LoadBank() (at Assets/Wwise/Deployment/Components/AkBankManager.cs:43)
AkBankManager:LoadBank(String) (at Assets/Wwise/Deployment/Components/AkBankManager.cs:108)
AkBank:HandleEvent(GameObject) (at Assets/Wwise/Deployment/Components/AkBank.cs:55)
AkUnityEventHandler:Awake() (at Assets/Wwise/Deployment/Components/AkUnityEventHandler.cs:39)
AkBank:Awake() (at Assets/Wwise/Deployment/Components/AkBank.cs:30)
It seems the banks cannot be found. Can you double check you generated your SoundBanks? In a Windows Explorer (or Finder) window, browse to your Wwise Project, and check the GeneratedSoundBanks folder. In that folder, you should see a folder named after your platform (Windows or Mac), each containing some .bnk files. Are they there?

If there is nothing there, make sure to generate your SoundBanks. In Wwise, go to Layouts > SoundBanks, and generate all your SoundBanks for your platform.
So, what do I do with the "footstep" script, exactly? add it to some existing script that controls the action of the character? or make a whole new script just for the footsteps?
...