La section Questions et réponses de la communauté Audiokinetic est un forum où les utilisateurs de Wwise et de Strata peuvent poser des questions et répondre à celles des autres membres de la communauté. Si vous souhaitez obtenir une réponse de la part de l'équipe de soutien technique d'Audiokinetic, veillez à utiliser le formulaire de Tickets de Soutien.

Unity player build error with UnauthorizedAccessException:

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?
demandé 8-Mai-2018 dans General Discussion par Mark A. (130 points)

1 Réponse

+3 votes
 
Meilleure réponse

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!

répondu 11-Jul-2018 par SHVFS G. (500 points)
sélectionné 12-Jul-2018 par 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.
...