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.

0 votes
When making a standalone player build in Unity for our windows project, after building once and doing a second build, I get the following:

UnauthorizedAccessException: Access to the path "D:\myCoolProject\Assets\StreamingAssets\Audio\GeneratedSoundBanks\Windows\Init.bnk" is denied.

I assume that these files are copied from the wwise project folder and they are indeed read only because they are checked into perforce.  I know why the files need to get copied, but they problem is if they exist there already from a previous build (and are marked read only as they are because they were copied from the wwiseProject folder to the StreamingAssets folder with the read only attribute set because they are checked into perforce).  Does wwise not handle this particular situation?
in General Discussion by Mark A. (130 points)

1 Answer

+3 votes
 
Best answer

We experienced the exact same issue and resolved it by changing 2 files:
In AkUtitlies around line 590:

var files = dir.GetFiles();
foreach (var file in files)
{
            var temppath = System.IO.Path.Combine(destDirName, file.Name);
            //Edit by Shanghai Vancouver Film School Game Design

            System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath);
            if (fileInfo.Exists)
                fileInfo.IsReadOnly = false;

            System.IO.FileInfo secondFileInfo = file.CopyTo(temppath, true);
            secondFileInfo.IsReadOnly = false;
}

And AkBuildPreprocessor around line 129:

//Edit by Shanghai Vancouver Film School Game Design
System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(destinationFolder);

if (dirInfo.Exists)
{
      foreach (System.IO.FileInfo f in dirInfo.GetFiles())
      {
            f.IsReadOnly = false;
      }
}
System.IO.Directory.Delete(destinationFolder, true);
UnityEngine.Debug.Log("WwiseUnity: Deleting streaming assets folder <" + destinationFolder + ">");
 

Hope it helps!

by SHVFS G. (500 points)
selected by Mark A.
Thanks.  Was pleased to see this.  It didn't occur to me at the time to look in the cs code to fix this, but this is a good idea.  I wound up solving this myself by marking the wwise files as +w so they were always writable
thanks a lot for this answer! You saved me so much time!
Thank you so much! You are a god send.
...