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.

Unity: Loading Banks and Playing Sound without Wwise Project

0 votes
Apologies if this has been definitively answered, but I've only seen some unsolved Qs through searching the website.

I want to provide team members with built banks without the need for them to have the entire Wwise project files. They will only be hearing the sound, not implementing. Those who need implementation power (using the picker, etc) I can provide the project. This is single platform Windows, and I've already exported the banks into the proper StreamingAssets folder within the unity project. However, I still (like others seemingly) get "Event Not Found" and bank loading errors from those who do not have the Wwise project.

Can we get a definitive answer on if this setup is possible, and if so, how? Thanks!
asked Apr 9, 2018 in General Discussion by Bob B. (130 points)
Hey Guys,
After digging into this issue a bit, I noticed it was an editor only problem and the issue seems to stem from line 94 of AkBasePathGetter.cs, if you change
        if (System.IO.Path.GetPathRoot(SoundBankDest) == "")
to
        if (SoundBankDest != "" && System.IO.Path.GetPathRoot(SoundBankDest) == "")

It seems to fix it.  Our issue stemed from SoundBankDest being empty string, and System.IO.Path.GetPathRoot throwing an exception on this causing the function to error out and not hit the backup soundbankdest string which points to where they actually are.  Hope this solves it.

5 Answers

0 votes
i'm guessing that you're trying to load the banks from the `GeneratedSoundbanks` directory that is only present with the project - can you confirm where you attempt to load banks from for clients who do not have the project data?
answered Apr 10, 2018 by Dan M. (360 points)
0 votes
This setup is definitely possible, it sounds like something might be off with the settings for where to load the soundbanks from, since only those that have the wwise project are able to correctly load the banks.

Make sure that you are loading the banks from the StreamingAssets folder.
answered Apr 10, 2018 by Kaan (260 points)
0 votes
 
Best answer

Hey Guys, 
After digging into this issue a bit, I noticed it was an editor only problem and the issue seems to stem from line 94 of AkBasePathGetter.cs, if you change
        if (System.IO.Path.GetPathRoot(SoundBankDest) == "")
to
        if (SoundBankDest != "" && System.IO.Path.GetPathRoot(SoundBankDest) == "")

It seems to fix it.  Our issue stemed from SoundBankDest being empty string, and System.IO.Path.GetPathRoot throwing an exception on this causing the function to error out and not hit the backup soundbankdest string which points to where they actually are.  Hope this solves it.

Already replied this but putting this as an actual answer

answered Apr 10, 2018 by Patrick W. (440 points)
selected Apr 13, 2018 by Bob B.
0 votes
Hi, I think that we were dealing with the same problem. It was caused by settings of Wwise in Unity. Since some recent patch, unity tries to generate sound banks itself before running the game (and it fails if it is not able to find the project folder). You can change this settings in Unity -> Edit -> Wwise Settings -> uncheck "Enable copying of soundbanks at pre-Build step".
answered Apr 13, 2018 by Radek Karnik (430 points)
0 votes

I wanted to do the same thing but ended up needing the multiplatform support, so this approach wouldn't work for me.

I just implemented this which seems to work, I will keep you guys posted if there's anything else to know.

I wanted all WWise editor and source files (including .wmu, .wproj, and the gigs of source .wav files) to live outside the Unity project, except for soundbanks, so that non-sound developers didn't have to see them.  I did NOT want soundbanks to live in the Assets/StreamingAssets/ folder, because it would have added all platforms (Mac/Windows/other) into all builds, wasting space.  The WWise build scripts are already setup, during builds, to temporarily copy only the platform (i.e. windows) you are actually building into StreamingAssets.

1) I created a new folder, arbitrarily named 'WwiseGeneratedSoundbanks' in the top-level Unity root (next to the Assets folder).  This gets checked into source control, and is generated manually by people working in the WWise editor (someday, maybe generated via build machine as well).  Everyone on the team gets this file when they sync the Unity folder in source control.

2) I set the WWise editor to generate to this folder in Project Settings

3) I had to modify the WWise Unity build script to hardcode this folder path (this is a bit klunkier than I like, but it works).  This is only needed for users that won't have the .wproj file available (i.e. you will need it for the rest of your team)

In AkBasePathGetter.cs, add this on (as of 3/15/2019 with WWise 2018.5) line 145,  after the first try/catch and before if (string.IsNullOrEmpty(SoundBankDest))

if (string.IsNullOrEmpty(SoundBankDest))
{
   const string hardcodedNonstandardPath = "../WwiseGeneratedSoundbanks/";
   var sourceSoundBankPath = hardcodedNonstandardPath + platformName;
   SoundBankDest = AkUtilities.GetFullPath(UnityEngine.Application.dataPath, sourceSoundBankPath);
}

4) in Unity, Edit -> WWise settings and fix the location of the .wproj file (same thing as editing <WwiseProjectPath> in WWiseSettings.xml file)

Note: this will disable the WWise picker and maybe other audio functionality for non-sound users who don't have the .wproj file, so your mileage may vary.  It will probably also disable building of WWise soundbanks from inside Unity, if that's important to your workflow, you probably can't move the WWise editor files outside the Unity project.  Also, not sure what happens if you try and reference WWise project elements (like events) from WWise Unity components.  This game happens to not need this functionality, so it works for me.

If you're using perforce, getting this going for the first time might be a little painful to make perforce happy. You may have to create some of the directories by hand the first time.

----

I hope that helped.  It would be cool if this was a more supported workflow out of the box, and if WWise's build scripts played nicer with perforce out of the box as well.

If this doesn't end up working for us in the long-term, I'd suggest (if using Perforce) doing some client-spec mapping to put the gigs of source .wav files somewhere else, while still keeping the rest of the WWise editor files available for use by non-sound designers/coders.

shameless plug: If anyone needs any help with this, my shop does technical consulting for WWise projects, hit us up http://audiotankstudios.com

answered 3 days ago by Dominic C. (140 points)
...