How to Send a Unity C# struct to Objective-C plugin?

Viewed 352

I am building a native objective-C plugin in Unity. I have a struct in unity that has the mesh data that I am trying to send to the Objective-C plugin.

My struct looks like this

public struct MeshData
{
    public float[] vertices;
    public int vertexCount;
    public int[] faces;
    public int faceCount;
    public byte[] faceClassifications;
    public float4x4 transformMatrix;
}

I looked into marshaling in C# but my plugin function doesn't get called. There is also no good documentation that explains how to do this.

Another thing I tried was to get and Intptr for the struct and then send it over to the Objective-C side but that approach failed as well.

I am not super experienced with moving pointers and converting memory to pointers in C# and then rebuilding them on the objective-C side.

How should I go about this?

0 Answers
Related