What is a Marshal in C#?? and where can i find the copy.Marshal


April 2019


28 time


I want to capture point clouds from the Meta 2 example MetaGetPointClouds and save them in to a PCD file. The code ends like this:

private void MarshalMetaPointCloud()
    _pointCloud.num_points = _metaPointCloud.num_points;

    int point_cloud_size = 3 * _pointCloud.num_points;

                  0, point_cloud_size);

can someone explain me what is Marshal.Copy, where the pointCloud.points are been saved and how to pass them in to a PCD file ?

This is for Unity Engine using META SDK

1 answers


Here is the related documentation

Marshall class

System.Runtime.InteropServices.Marshall Class documentation.

Provides a collection of methods for allocating unmanaged memory, copying unmanaged memory blocks, and converting managed to unmanaged types, as well as other miscellaneous methods used when interacting with unmanaged code.

Copy method


Copies data from a managed array to an unmanaged memory pointer, or from an unmanaged memory pointer to a managed array.