public static uint SurfaceObjectCreate(Vector3 position, Quaternion rotation, SM64Surface[] surfaces) { var surfListHandle = GCHandle.Alloc(surfaces, GCHandleType.Pinned); var t = SM64ObjectTransform.FromUnityWorld(position, rotation); SM64SurfaceObject surfObj = new SM64SurfaceObject { transform = t, surfaceCount = (uint)surfaces.Length, surfaces = surfListHandle.AddrOfPinnedObject() }; uint result = sm64_surface_object_create(ref surfObj); surfListHandle.Free(); return(result); }
static extern uint sm64_surface_object_create(ref SM64SurfaceObject surfaceObject);