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.