I am a game developer, and I am quite familiar with integrating FMOD in Unity. However, recently, I have encountered a strange issue when trying to load encrypted FSB files in Unity.
When using the fmodSystem.createSound function to load audio, sometimes it succeeds in reading the audio, but other times it fails with an ERR_VERSION error, which is quite puzzling.
I am using Unity version 2021.3.21f1, FMOD Studio version 2.02, and FMOD Engine version 2.02, and all the tool versions are perfectly matched!
Here is my code:
CREATESOUNDEXINFO exinfo = new CREATESOUNDEXINFO(); byte encryptionKeyBytes = System.Text.Encoding.UTF8.GetBytes(encryptionKey); exinfo.encryptionkey = Marshal.AllocHGlobal(encryptionKeyBytes.Length); Marshal.Copy(encryptionKeyBytes, 0, exinfo.encryptionkey, encryptionKeyBytes.Length); exinfo.cbsize = Marshal.SizeOf(exinfo); res = fmodSystem.createSound(path, FMOD.MODE.CREATESTREAM, ref exinfo, out curFSBSound); Marshal.FreeHGlobal(exinfo.encryptionkey);
Any help or insight into resolving this issue would be greatly appreciated!