"Komatsu teaches you to tour the development of" Unity System Module Development "Heat more

Source: Internet
Author: User

Now the Hand Tour project if not a hot update iteration at all, especially like our project to do MMO is more often need to change the code.

Today's projects typically choose to use LUA to implement hot updates

But our project is not used for historical reasons, and it's a different kind of solution.

All gameobject in the project do not hang scripts (the Ngui scripts are hung by code), scripts that do not inherit mono and become DLLs, and then use a startup script to open the DLLs.

However, there is a problem, iOS can not heat more ...

In any case, let's talk about how to do this plan first.

First, there are two parts, part is packing, part is unpacking.

And the package is divided into resource bundles and code packages.

Pack first.

1. Resource packaging before writing another article has written to

http://blog.csdn.net/chrisfxs/article/details/55046339

2. Code Packaging

That's what we've been saying before.

http://blog.csdn.net/chrisfxs/article/details/53213640

The main is to put the code all into a DLL, with textasset type Open and then hit into Assetbundle

And then the unpacking.

1. Resource Unpacking

Resource unpacking is also preceded by a talk

http://blog.csdn.net/chrisfxs/article/details/55046339

In fact, the main thing is to say that the code to unpack

2. Code Unpacking

First you need to have a script Loadingscript as an initialization entry for the entire project

In the awake of this script to do a variety of configuration, such as according to different platforms to obtain different file paths, play CG, splash screen, etc.

Set the flag bit to start initialization in the start function.

Start working in various states in update

1. Download the assetbundle of the script

2. Reflection

TextAsset asset = www.assetBundle.LoadAsset<TextAsset>(fileName);  Assembly assembly = Assembly.Load(asset.bytes);  

3. Get the script to create the main mono, which is the main logic entrance of the game, and hang it in gameobject (here we are clientmain)

Type script = assembly.GetType(scriptName);//这个是脚本名字,这里是ClientMain  gameObject.AddComponent(script);  

4. If there are other scripts that need to be hung, the same way you hang them.
Then all logic is expanded in the start of the Clientmain script.

"Komatsu teaches you to tour the development of" Unity System Module Development "Heat more

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.