sviudes
September 28, 2015, 11:07am
1
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:
FMOD.CREATESOUNDEXINFO exinfo = new FMOD.CREATESOUNDEXINFO();
exinfo.cbsize = Marshal.SizeOf(exinfo);
am I doing anything wrong?
nick1
September 29, 2015, 12:58am
2
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:
FMOD.CREATESOUNDEXINFO exinfo = new FMOD.CREATESOUNDEXINFO();
exinfo.cbsize = Marshal.SizeOf(exinfo);
am I doing anything wrong?
What version of Unity are you using?
nick1
October 6, 2015, 5:32am
4
Until Unity fixes their IL2CPP system you can try replacing the createStream function with
[DllImport(VERSION.dll)]
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
Until Unity fixes their IL2CPP system you can try replacing the createStream function with
[DllImport(VERSION.dll)]
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;
}
Thanks Nicholas, I’ll try it