Cross platform functionality for csharp
and rust
Protobuf file generation and extraction of .dll
files for Unity.
Utilizes docker container.
- make
- docker
- Create proto3 compliant
.proto
files - With docker container generate
.rs
and.cs
protobuf files using protoc from v3.14.0 release with rust plugin and well-known google types - Download
.dll
files for use with Unity from releases or extract manually
One-time setup: make build
to build docker image
Then, to execute the following example steps all at once, just use make all
. Otherwise follow the next steps.
Tip: If the following commands cause you trouble, try to leave out shell
in the docker run -v $(shell pwd)
part. Just use $(pwd)
instead.
Place your .proto
files in directory, then use: make generate-schema
OR:
docker run -v $(shell pwd):/mounted gameroasters/protobuf-unity:latest /bin/bash -c "\
protoc -I=/mounted/ --rust_out=/mounted/ /mounted/*.proto && \
protoc -I=/mounted/ --csharp_out=/mounted/ /mounted/*.proto"
This will generate .cs
and .rs
files with your .proto
schema type serialiation in csharp and rust (inside proto/
with make command).
To manually extract .dll
files for Unity, use: make extract-dlls
OR:
docker run -v $(shell pwd):/mounted gameroasters/protobuf-unity:latest /bin/bash -c "\
cp /protobuf/dlls/*.dll /mounted/"
This extracts the .dll
files (inside dll/
folder with make command). Just drop these into your Unity project.
To bundle into .zip
archive, after executing previous step, use:
docker run -v $(shell pwd):/mounted gameroasters/protobuf-unity:latest /bin/bash -c "\
rm -f /mounted/protobuf_unity_dlls.zip && \
zip /mounted/protobuf_unity_dlls.zip mounted/*.dll"
OR: make extract-dlls-zip
without any prerequisite step
- support protobuf master builds