Skip to content

Cross platform functionality for csharp and rust Protobuf file generation and extraction of .dll files for Unity.

License

Notifications You must be signed in to change notification settings

gameroasters/protobuf-unity-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

protobuf-unity-docker

Cross platform functionality for csharp and rust Protobuf file generation and extraction of .dll files for Unity. Utilizes docker container.

Requirements

  • make
  • docker

Usage

  1. Create proto3 compliant .proto files
  2. With docker container generate .rs and .cs protobuf files using protoc from v3.14.0 release with rust plugin and well-known google types
  3. Download .dll files for use with Unity from releases or extract manually

Example usage

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.

Generate .cs and .rs schema files

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).

Extract .dll files

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.

Optional: Extract into .zip archive

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

TODO:

  • support protobuf master builds