Let's get back into the swing of these!
During the Kickstarter I'm using any free time I have to study and make little systems to get familiar with systems we may end up using
I got interested in how easy it would be to de/serialize such data, given these types can have precise memory layouts specified for them. The that end I was making little `BinaryWriter`s and readers that had Write methods that could take any blittable type or array of blittables and handle them correctly.
I'm going to make a dump of some useful links as most of the stuff I was doing was simple enough, but was a good exercise for familiarity. It was the first time I've significant use of pointers in c# and it was a very simple and unsurprising experience.
The first handy thing was that the unmanaged constraint is available. Whilst unmanaged types are not the same as blittable types there is a useful overlap. Using this allows us to have signatures like `unsafe void Foo
- Heap allocate, check out all of Marshal, it's pretty handy
- You can explicitly cast typed pointers to `IntPtr`
- But then you find UnsafeUtility in Unity itself and it's way better. `memcpy`, `malloc` etc are all there
The big disappointment of the day is how quickly one ends up having to reinvent the wheel as most Streams, Buffers, Writers, etc, never expose their buffer or provide overloads taking `IntPtr`. The more you poke to work around this the more it feels like you should just make your own. It's not ideal. Saying that, I have spent most of today in dotnet code rather than Unity's so I do still need to see what is there.