'FMOD.CREATESOUNDEXINFO' cannot be marshaled

I’m using Unity plugin, and my code is working on PC. But when I run on iPhone, xCode gives me this error:

ArgumentException: Type ‘FMOD.CREATESOUNDEXINFO’ cannot be marshaled
as an unmanaged structure; no meaningful size or offset can be
computed. at System.Runtime.InteropServices.Marshal.SizeOf
(System.Type t)

when I execute this code:

exinfo.cbsize = Marshal.SizeOf(exinfo);

am I doing anything wrong?

What version of Unity are you using?

I’m using 1.06.10

Until Unity fixes their IL2CPP system you can try replacing the createStream function with

private static extern RESULT FMOD5_System_CreateStream           (IntPtr system, byte[] name_or_data, MODE mode, IntPtr exinfo, out IntPtr sound);

public RESULT createStream            (string name, MODE mode, out Sound sound)
	sound = null;
	byte[] stringData;
	stringData = Encoding.UTF8.GetBytes(name + Char.MinValue);
	IntPtr soundraw;
	RESULT result = FMOD5_System_CreateStream(rawPtr, stringData, mode, IntPtr.Zero, out soundraw);
	sound = new Sound(soundraw);
	return result;
1 Like

Thanks Nicholas, I’ll try it