Assetbundle value setting problem in Inspector interface of Unity5

Source: Internet
Author: User

Note: Editor extension aspect Unity5 AssetbundleUnity5 has made a great adjustment to Assetbundle, which is very different from the old version, for example, if a resource has been packaged and if the resource does not have any updates, the resource will not be packaged. Packaging also generates a "*.manifest" file with the same name as the file, which records information about the bundled bundle file. Additionally, the options for Assetbundle name and file extension are also shown in the Inspector panel.
Recently, there is a need to set the Assetbundle file name and suffix of multiple resource files by using the editor extension method. The code is as follows:    [MenuItem("Tool/setfilebundlename")]   StaticvoidSetbundlename ()    {
#region set the Assetbundle name and file extension for a resourceUnityengine.Object[] Selects =Selection. Objects;        foreach(unityengine.Objectselectedinchselects)        {           stringPath =Assetdatabase. Getassetpath (selected);           AssetimporterAsset =Assetimporter. Getatpath (path);asset.assetbundlename = selected.name;//Set the name of the bundle fileasset.assetbundlevariant = "Unity3d";//Set the extension of the bundle fileAsset. Saveandreimport ();                    }Assetdatabase . Refresh (); #endregion    }
In this way, select multiple resources in the Project panel to click on the menu item "Tool/setfilebundlename"Automatically sets the Assetbundle key to the name of the resource and sets the suffix to" unity3d ". Note: At this time the Inspector panel is not refreshed in a timely manner, may see or none, but has actually been set up, just need to click on any other files mouse, then point back can be seen.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Assetbundle value setting problem in Inspector interface of Unity5

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.