StreamingAssets fail to copy due to invalid path name in EventManager.cs (upgrade to 2.00.00 integration)

#1

This is an error we started getting in Unity 2018.3.7f1 after upgrading to FMOD 2.00.00 from 1.10.11. It appears to happen when the banks are copied (unsuccessfully) to the StreamingAssets folder. From my digging, it seems that this has something to do with some of the paths of the banks in EventManager.cs being stored as absolute paths and not relative. This doesn’t seem to be an issue with the Master.strings.bank for some reason.

The Path for Master.strings is “Assets\FMODAssets\Desktop\Master.strings.bank” while the path for the next bank in the list is “D:\Repos\MyGame\MyGame\Assets\FMODAssets\Desktop\Battle.bank”. This causes the subDir variable on line 525 of EventManager.cs to provide an improper value and thus create invalid Paths on the next lines.

Please let me know if I can provide any additional information.

These are the errors from Unity:

FMOD Studio: copy banks for platform Windows : copying banks from Assets\FMODAssets\Desktop to D:/Repos/MyGame/MyGame/Assets/StreamingAssets
UnityEngine.Debug:LogError(Object)
FMODUnity.EventManager:CopyToStreamingAssets() (at Assets/3rdParty/Editor/Plugins/FMOD/src/Editor/EventManager.cs:555)
FMODUnity.EventManager:OnCacheChange() (at Assets/3rdParty/Editor/Plugins/FMOD/src/Editor/EventManager.cs:597)
FMODUnity.EventManager:Update() (at Assets/3rdParty/Editor/Plugins/FMOD/src/Editor/EventManager.cs:609)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

IOException: Win32 IO returned ERROR_INVALID_NAME. Path: D:\Repos\MyGame\MyGame\Assets\StreamingAssetsD:
System.IO.Directory.CreateDirectoriesInternal (System.String path) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.IO.Directory.CreateDirectory (System.String path) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.IO.DirectoryInfo.Create () (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
(wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.Create()
System.IO.Directory.CreateDirectoriesInternal (System.String path) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.IO.Directory.CreateDirectory (System.String path) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.IO.DirectoryInfo.Create () (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
(wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.Create()
System.IO.Directory.CreateDirectoriesInternal (System.String path) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.IO.Directory.CreateDirectory (System.String path) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.IO.DirectoryInfo.Create () (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
(wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.Create()
System.IO.Directory.CreateDirectoriesInternal (System.String path) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.IO.Directory.CreateDirectory (System.String path) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.IO.DirectoryInfo.Create () (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
(wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.Create()
FMODUnity.EventManager.CopyToStreamingAssets () (at Assets/3rdParty/Editor/Plugins/FMOD/src/Editor/EventManager.cs:538)
UnityEngine.Debug:LogException(Exception)
FMODUnity.EventManager:CopyToStreamingAssets() (at Assets/3rdParty/Editor/Plugins/FMOD/src/Editor/EventManager.cs:556)
FMODUnity.EventManager:OnCacheChange() (at Assets/3rdParty/Editor/Plugins/FMOD/src/Editor/EventManager.cs:597)
FMODUnity.EventManager:Update() (at Assets/3rdParty/Editor/Plugins/FMOD/src/Editor/EventManager.cs:609)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
1 Like

#2

Thanks for reporting this. We have found and fixed the problem for the next release.

In the meantime you can find the fix on our Github:

0 Likes

#3

Thanks for the quick reply @cameron-fmod . I went ahead and updated our code with the fix on GitHub but I’m still seeing the same errors on my end. Let me know if there’s any additional info I can provide.

0 Likes

#4

Can you try deleting the FMODStudioCache.asset and then refreshing the banks.
This won’t destroy anything, it will be recreated when the new banks a reloaded.

0 Likes

#5

Same errors after deleting deleting FMODStudioCache.asset and refreshing the banks. I also tried deleting the contents of the StreamingAssets folder just in case, but it didn’t change anything.

The first time after refreshing banks from the FMOD menu in Unity, I get this error as well (not sure if it’s related):

FMOD Studio: Unable to load Master.strings: The specified bank has already been loaded.
UnityEngine.Debug:LogError(Object)
FMODUnity.EventManager:UpdateCacheBank(EditorBankRef) (at Assets/3rdParty/Editor/Plugins/FMOD/src/Editor/EventManager.cs:462)
FMODUnity.EventManager:UpdateCache() (at Assets/3rdParty/Editor/Plugins/FMOD/src/Editor/EventManager.cs:306)
FMODUnity.EventManager:RefreshBanks() (at Assets/3rdParty/Editor/Plugins/FMOD/src/Editor/EventManager.cs:36)
0 Likes

#6

Apologies, this is a slightly different bug to the one I mentioned the fix for.
I’m working on this at the moment and will get back to you once I have found the ‘nicest’ fix.

0 Likes

#7

Thanks for your patience, I believe we have a fix for the issue:

0 Likes

#8

Still coming back with the same error. I think it has to do with the bankRef.Name of the second bank in eventCache.EditorBanks returning the entire path. It has the right Name at initialization, but after the foreach (var bankRef in eventCache.EditorBanks) on line 526 loops the second time, the path changes to the incorrect string for some reason.

This is from the Unity Debugger after it updates to the wrong value:

Name:"D:\\Repos\\Gravastar\\Gravastar\\\\Battle-Baird"
Path:"D:\\Repos\\Gravastar\\Gravastar\\Assets\\FMODAssets\\Desktop\\Battle-Baird.bank"
SubDir:"D:\\Repos\\Gravastar\\Gravastar\\"

Let me know if there’s anything else I can provide to help troubleshoot. I deleted the cache and refreshed banks to test this.

0 Likes

#9

Thanks very much for helping us with this issue by the way.

Does this only occur if you manually type in the project/build path in the settings?
If you use the ‘Browse’ button to find the folder, does this use the correct paths?

0 Likes

#10

You are correct. We are using a Multiple Platform Build and I had defined the Build Path as Assets\FMODAssets. When I used the browse button to select the same folder, there is now a new field below Build Path that loads a greyed out version of the full path labeled as the “Platform specific path”. The Build Path still shows Assets\FMODAssets, but the StreamingAssets are correctly loading without the IOException now.

Will this cause issues in source control, since the “Platform specific path” field is using the absolute path for my machine specifically? Or will this load the proper path for my teammates on their machines?

I also noticed that the FMODStudioSettings.asset now lists the banks with a slash in front of them:

  MasterBanks:
  - \Master
  Banks:
  - \Battle-Baird
  - \Battle-Criddler
0 Likes

#11

Also, will my teammates need to delete their local FMODStudioCache.asset and browse to the path manually on their local repos as well, or will this propagate through source control? We don’t have the FMODStudioCache.asset stored in the repo, due to the source control suggestions from the FMOD best practices page.

0 Likes

#12

The Build Path is the one that gets serialized, the other one is then calculated for that particular machine using the Build Path.

I also fixed up the leading ‘\’ in the bank names in the settings.

0 Likes

#13

today,I update our project,the same problem has happened.There are some screenshots before using fixes

.And these are some screenshots after using fixed
code

0 Likes

#14

When you say you updated the project, have you also included the changes made in our Github repo?

0 Likes

#15

This appears to be working for me with the most recent fixes from GitHub. I still need to see if the changes propagate to our other team-members properly, but I’ll monitor as we move forward to see if anything else crops up. Thanks for the assistance @cameron-fmod!

1 Like

#16

I remove all files under the StreamingAssets file,and the operation copying banks successed.Should I update my project from 1.10 to 2.0. I am worried about the problems that will occur:rofl:

0 Likes

#17

A new patch version should be coming out in the next week, this will contain the fix for this issue as well as some others.

Keep in mind that 2.0 is in ‘early access’ and will no doubt have some teething issues, although it will also have features that the older, more stable versions do not.

0 Likes