public static List <MetaioCamera> getCameraList() { List <MetaioCamera> ret = new List <MetaioCamera>(); uint length = 0; IntPtr pbList = listCamerasInternal(out length); try { if (pbList == IntPtr.Zero || length == 0) { Debug.LogError("listCamerasInternal failed"); return(ret); } byte[] pbAsBytes = new byte[length]; Marshal.Copy(pbList, pbAsBytes, 0, (int)length); metaio.unitycommunication.ListCamerasProtocol pb = metaio.unitycommunication.ListCamerasProtocol.ParseFrom(pbAsBytes); for (int i = 0; i < pb.CamerasCount; ++i) { ret.Add(MetaioCamera.FromPB((metaio.unitycommunication.Camera)pb.CamerasList[i])); } } finally { freeReturnedMemory(pbList); } return(ret); }