Unity: MarshalAs UnmanagedType.LPArray always returns with array of size 1 in iOS

  c++, marshalling, unity3d, unityscript

I’m trying to send a native c++ short array to c# side via masrhalling:

delegate void OnMoreDataInter( [In, MarshalAs(UnmanagedType.LPArray,
SizeParamIndex = 1)] short[] moreData, int moreDataSize);

This code works perfectly in Windows and Android. However, the returned array size is always 1 on C# side for iOS.

I have applied the approach in the topic:

https://answers.unity.com/questions/1213739/il2cpp-c-passed-ref-float-to-c-cant-get-right-resu.html

but iOS fails.

Do you know any specific exception or configuration for iOS on marshalling array in iOS?
Thanks.

Source: Windows Questions C++

LEAVE A COMMENT