Protocol buffers for Unity
Ensure that you have Git properly installed on your system.
- Copy the git url:
https://github.com/rpopic2/protobuf-unity.git
-
In Unity, navigate to and open
Windows > Package Manager
-
Click the plus sign('+') and select
Add package from git URL...
![Screenshot 2023-09-12 at 10 37 38](https://private-user-images.githubusercontent.com/8055265/267185333-ccc4a325-4e0d-4a0f-8861-ebd14ef688b7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1OTI0NTgsIm5iZiI6MTcyNDU5MjE1OCwicGF0aCI6Ii84MDU1MjY1LzI2NzE4NTMzMy1jY2M0YTMyNS00ZTBkLTRhMGYtODg2MS1lYmQxNGVmNjg4YjcucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgyNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MjVUMTMyMjM4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Y2NiZGQyZWQwNGZjMzljNjA0MWQ1M2NkYmI1YTdlZDI3ZTMyYjJhMjQ5ZmMwMzQwMGI1MzZlYTBiNTQ0Yjk1MSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.0_b_tgcie_2S-tdbsSJNI4w93-niiY-IKyWY_bADTm4)
-
Paste the git url and click the
Add
button. -
In Project Settings > Player > Other Settings > Api Compatibility Level, ensure it is set to
.Net Standard 2.1
You might also want to install the Protocol buffers compiler (protoc
) to generate code from your .proto
files.
To install protoc
, please follow the official installation instructions provided in the protobuf GitHub repository.
Official protobuf GitHub repository
I wanted to use protobuf in my Unity project, and I found that it could be only installed via nuget packages, which do not work with Unity. So I searched for other protobuf plugins for Unity, and it either had too much abstraction around it, or provided GUIs that I didn't really care. This package includes only the protobuf dll binaries that Google provided, and nothing more. I removed duplicate dlls for different frameworks, because Unity complained about them. That's all. This is the protobuf as-is.