Use of the "Unity" Protobuf and FAQs

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.