protobuf flow of Use
Protobuf Reference Tutorial: https://www.jianshu.com/p/b135676dbe8d
After writing the. proto file, run the Protoc.exe compiler with the cmd command line, enter the. proto file path to generate the C # file, and then put the C # file into use in your unity project.
This method can generate C # files, but is not recommended. This method starts with a. proto file, and for a written C # entity class, you need to write a. proto file, and then regenerate the C # file before you can use it.
or use protobuf-net:http://www.cnblogs.com/xuf22/articles/3504399.html
The reason is the official Protobuf C # implementation requirements. Net4.6 and above, while Unity uses the. NET low version (the old version is the highest.) Net3.5, depends on the unity version).
Add tags to the written C # entity class.
or use protobuf-unity:https://github.com/5argon/protobuf-unity
This is the Unity Editor plugin. Protobuf normal use of the process is handwritten. proto files, run the Protoc.exe compiler with the cmd command line, enter the. proto file path to generate C # files, and then put the C # file into the Unity project for use. The plugin automatically finds all the. proto files in the Unity project and generates all corresponding C # files in one click (appearing in the same directory as each. proto file). and the C # file is automatically regenerated when the. proto file is modified!
ProblemsMissing Input File
When using Protoc.exe on the command line, an error missing input file. The. proto file is not found under the currently set--proto_path directory. For example, Protoc.exe and Person.proto files are in the same directory.
The cause is a malformed format, and a space after the file path =./is added!!!!!!!!!Unity does not support. Net3.5 and aboveIf the. NET version selected when compiling Google.Protobuf.dll is too high, importing the DLL into a unity project can see that the DLL is not working, such as. and the. proto file generates an error in the C # file. You can now modify the. NET version in Visual Studio and recompile the DLL. Modify the method. or modify the. NET version in Unity (requires a newer version of Unity). In Edit-project Settings-player, use the. Net4.6, then restart the Unity editor.
Use of the "Unity" Protobuf and FAQs