[Unity3d] [NGUI] packaging NGUI premade parts into Assetbundle.

Source: Internet
Author: User

Next, because the UI needs to be updated in the project, I used the AssetBundle solution.


Generally, we use AssetBundle to generate a resource package. The common solution is as follows:

Using UnityEngine; using UnityEditor; // <summary> // export the resource class /// </summary> public class ExportGameResources {static BuildAssetBundleOptions m_option = dasbuilsetbundleoptions. collectDependencies | // collect all dependencies BuildAssetBundleOptions. deterministicAssetBundle; // <summary> // export NGUI to Assetbundle /// </summary> [MenuItem ("Assets/export/resource")] static public void ExportNGUI () {// obtain the Object [] objs = Selection selected in the editor. getFiltered (typeof (Object), SelectionMode. deepAssets); // if (objs. length = 0) {return;} string _ savepath = null; // determines whether multiple-choice or single-choice if (objs. length = 1) {// obtain the Save path _ savepath = EditorUtility. saveFilePanel ("Save Resource", "", objs [0]. name, "assetbundle"); // generate assetbundle BuildPipeline. buildAssetBundle (objs [0], null, _ savepath, m_option, EditorUserBuildSettings. activeBuildTarget);} else {// obtain the Save path _ savepath = EditorUtility. saveFolderPanel ("Save Resources", "", ""); // generate assetbundle for (int I = 0; I <objs. length; ++ I) {BuildPipeline. buildAssetBundle (objs [I], null, _ savepath + "/" + objs [I]. name + ". assetbundle ", m_option, editoruserbuildsetattributes. activeBuildTarget );}}}}

This is the method I first wrote to package NGUI pre-parts into Assetbundle.
This method does not seem to be a problem, and it is no problem to use WWW stream loading.
But is that true?

In fact, I didn't notice the resource dependency in AssetBundle at the beginning.

Because the several Assetbundle0 that I first generated are several prefabricated parts in the ngui demonstration, the generated size is usually several K to several dozen K.


So I thought it would be nice to use it.

It wasn't until I started to make several interfaces that needed Chinese text support that I jumped into a trap.


TODO :.................


PS: this Blog is not a professional technical Blog.

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.