Audiokinetic의 커뮤니티 Q&A는 사용자가 Wwise와 Strata 커뮤니티 내에서 서로 질문과 답변을 하는 포럼입니다. Audiokinetic의 기술 지원팀에게 문의하고 싶으신 경우 지원 티켓 페이지를 사용해주세요.

Unity player build error with UnauthorizedAccessException:

0 투표
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?
문의 2018 5월 8 General Discussion Mark A. (130 포인트) 로 부터

1 답변

+3 투표
 
우수 답변

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!

답변 2018 7월 11 SHVFS G. (500 포인트) 로 부터
선택됨 2018 7월 12 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.
...