- Home /
Question by
fatih_k · Jul 09, 2021 at 08:43 AM ·
c#scripting problemiosc++
MarshalAs UnmanagedType.LPArray always returns with array of size 1 in iOS
Hi Unity People,
I have a challenging problem. I'm trying to send a native c++ 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.
Please note that I observed the very same problem when I compiled the project for Android via IL2CPP 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
Apparently, IL2CPP causes this problem
Do you know any specific solution for this issue on marshalling array in iOS? Thanks.
Comment