Unity Hot Update C # Combat experience sharing (i)

Source: Internet
Author: User

Demo Project address: HTTP://PAN.BAIDU.COM/S/1QWBYXQC

We're going to continue with the story http://www.cnblogs.com/zyc-it/p/4820810.html

(1) Engineering separation

What is engineering separation, is to put your game pack (hereafter referred to as #主工程 #), and your Hot update works (hereafter referred to as #热更新工程 #) separated away. First, let me tell you why I do this:

Reason: The JSB project, updated from GitHub, wrote all the hot update codes in unity, and then referenced the CS files in the Thermal update project. In my opinion is not really decoupling, there are some potential risks (intuition ~~! )

How to do: very simple, I take my demo project as an example, I built a new project (demo inside the use of JSB, is my own change, jsbsetting.cs configuration inside there are a lot of things with not easy), I added to play Hot update project,

That my hot update project How to refer to the original already bound CS class, OK, I compile the Unity master project, and then use the Hot Update Project reference can be

at this time can be assured that in the Heat update project to write codePlease remember that you are using VS (universe first editor, write hot update code, my various grammar hints, highlighting, very convenient), I just want to say that you like to use Luastudio, Notepad, write hot update script, I do not stop you, I am ugly I use vs (2) Namespace protectionReason: jsbsetting There are various directory configuration, indicating that the directory inside the class, export or do not export, remember these things too tired, too insecure. You imagine, when the programmer writes the code, remember the class I want to export, in that folder ...What to do:What do you mean, all of my export classes have a specific namespace prefix, why do I do this, remember the first experience, I refer to the main project generated DLL, I can use DLL-specific namespaces inside the class, other namespaces inside the class is not allowed,Is unsafe , is not exported, is very dangerous, is sure to go wrong. So to summarize, let the Heat update project only can refer to the main project within the specific namespace, the code is very safe. Next, I will share jsb how to use Protobuff as the network protocol, and its specific usage, and finally welcome everyone to join the JSB group: 189738580.

Unity Hot Update C # Combat experience sharing (i)

Related Article

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.