convenient cross platform way to use flatbuffers for unity:
- build flatbuffers .net DLL compatible with Unity
- easy flatc schema code generation using docker container
based on dotnet docker image
Uses latest master commit of flatbuffers
- create your schema fbs (
schema.fbs
) - use flatc to generate your code (flatc bin in docker image)
- grab .net DLL for unity from releases
- done
Use:
docker run -it -v $(pwd):/fb gameroasters/flatbuffers-unity:latest /bin/bash -c "cd /fb && \
flatc -n --gen-onefile schema.fbs && \
flatc -r --gen-onefile schema.fbs"
mv schema_generated.rs schema.rs
this will generate a schema.cs
and schema.rs
with your schema.fbs
schema type serialiation in rust and csharp.
use:
make extract-dll
or
docker run -v $(pwd):/dotnet gameroasters/flatbuffers-unity:latest /bin/bash -c "\
cp /flatbuffers/net/FlatBuffers/bin/Release/FlatBuffers.dll /dotnet && \
cp /flatbuffers/net/FlatBuffers/bin/Debug/FlatBuffers.dll /dotnet/Flatbuffers.Debug.dll"
this extracts the Flatbuffers.dll