Answered
0
0

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?

  • You must to post comments
Best Answer
1
0

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;
}
  • Sergio
    Thanks Nicholas, I’ll try it
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.