[Unity3d] [NGUI] Packaging NGUI prefabricated parts into assetbundle two kinds of ideas.

Source: Internet
Author: User

Http://www.58player.com/blog-2537-85030.html

I used the Assetbundle solution because of the need for a UI hot update in the project.

In general, we use Assetbundle to generate resource bundles commonly used scenarios such as the following:

Using Unityengine;
Using Unityeditor;

<summary>
Export Resource Class
</summary>
public class Exportgameresources
{
static buildassetbundleoptions m_option = Buildassetbundleoptions.collectdependencies | Collect all dependencies
Buildassetbundleoptions.deterministicassetbundle;
<summary>
Export Ngui into Assetbundle
</summary>
[MenuItem ("assets/Export/resource")]
static public void Exportngui ()
{
Gets the selected item in the editor
object[] Objs = selection.getfiltered (typeof (Object), selectionmode.deepassets);

No items selected
if (OBJS. Length = = 0)
{
Return
}

string _savepath = null;
Judging whether it's a multi-choice or a radio
if (OBJS. Length = = 1)
{
Get Save Path
_savepath = Editorutility.savefilepanel ("Save Resource", "" ", Objs[0].name," Assetbundle ");

Generate Assetbundle
Buildpipeline.buildassetbundle (objs[0], NULL,
_savepath,
M_option,
Editoruserbuildsettings.activebuildtarget);
}
Else
{
Get 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,
Editoruserbuildsettings.activebuildtarget);
}
}
}
}

This is the way I first wrote about packaging Ngui precast pieces into Assetbundle. This method does not seem to be a problem, and using WWW stream loading is no problem. But is it true?
In fact, I didn't notice the problem of resource dependency in Assetbundle in the beginning.
Because the first few Assetbundle0 that I generated were the few precast parts in the Ngui demo, the resulting size was normally several k to dozens of K.

So I naively thought it would be good to use it.
I did not find myself jumping into a small hole until I started to do several interfaces that required Chinese text support.

Todo:.................

PS: This blog does not count what professional technical blog, just essays.

[Unity3d][ngui] packaging NGUI precast parts into Assetbundle two ideas.

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.