Custom data type of _varying_ size? (gasp)

Options
hi folks!
I'm trying to serialize mesh data from a CV algorithm that detects a hand mesh in realtime (the Magic Leap One's hand tracker). Basically, two (large) arrays of vertices and indices that feed into a mesh every frame - everything else is under the hood and inaccessible through Unity.
The problem is that it detects varying amounts of vertices and indices (see picture - every frame I'm printing out the perceived total number of 1. vertices and 2. indices), so I'm not sure how to create a custom data type to serialize when I don't know its total size upfront.

Image: https://www.imgur.com/a/NVqbkNw (embedding didn't work, sorry)

That said, I don't have a lot of experience with serialization over a network and it could well be that I'm missing something basic. If you have any other ideas of how to go about this, I'd appreciate it!

tl;dr: Is there a way to serialize an array (or two) of an unknown size?

Thanks a bunch!

Comments