[C#] Setting Studio ADVANCEDSETTINGS encryptionkey?

Hi, I’ve been trying out the new 2.00 API, and I’m really happy about the new encryption function being added.

I am having some trouble getting it to work, though, the problem being setting the FMOD.STUDIO.ADVANCEDSETTINGS in Unity C# without the integration package.

How would you set the ‘encryptionkey’ parameter of type FMOD.StringWrapper? Would you need to set StringWrapper::nativeUtf8Ptr? I am having trouble understanding how to handle this data type, and have tried modifying the wrapper struct by adding a public accessor and setting the IntPtr with Marshal.StringToCoTaskMemAnsi(string key), but then when I set the system.setAdvancedSettings and getAdvancedSettings again, when I log the encryption key, it returns a zero-length string.

Thanks for your time!

This is perfect timing as I have just finished adding support for this for our next release.

The main issue is that the EncryptionKey in the ADVANCEDSETTINGS shouldn’t be a StringWrapper, it should be an IntPtr. We use StringWrappers for getting strings out of native code and IntPtr’s or byte arrays for passing them in. This way we can ensure that they are UTF8 encoded.

As I said, this has been added to our next release with is currently scheduled to be released in a couple of weeks.

That’s great to hear! Thanks so much for all the behind-the-scenes work.