Previous chapter: "Unity3d Technical Document Translation" article 1.8 Assetbundles Problems and solutions
Chapters in the original chapter: "Unity Manual" → "Working in Unity" → "Advanced Development" → "assetbundles" → "Unity Asset Bundle Browser Tool"
Unity assetbundle Browse Administration Tool (Unity Asset Bundle Browser tool)
Note : This tool is an additional feature beyond Unity's standard functionality. To use it, you need to download it from GitHub (click the link) and install it separately after downloading and installing the Unity editor.
This tool allows you to browse and edit the structure of the assetbundles in your project. It will prevent you from creating invalid Assetbundle, as well as reminding you of existing assetbundles if there are some problems. It also has basic build functionality.
Before we select resources and manually set their assetbundle in the editor, we can now also use the Assetbundle Browse management tool to handle these. It can be used in any Unity5.6 and above (drag the assetbundlebrowser folder to any location in the project) and will create a new menu option under the Window menu Assetbundle Browser. Its configure and build features are divided into two tab bars in the new window (the latest has three tabs and one inspect tag):
Requires Unity5.6 and above version Configure window to use
Note: This feature is in pre-release status, so before you use it, we recommend that you back up your project.
This window provides a browser-style interface for managing and modifying Assetbundles in your project. The first time you open the tool, it will parse all the assetbundles data in the background and slowly mark the warnings and errors it detects. It will stay in sync with the project as much as possible, but it is not always aware of the dynamics happening outside the tool. To force error detection, or to update the status of the tool, click the Refresh button in the upper-left corner.
The window is divided into four sections: Bundle list, bundle details (bundle detail), resource list (Asset list), and resource details (Asset detail).
Bundle List
The left pane shows all the assetbundles in the project. The available features are:
- Select one or a batch of Bundles to view the resources contained in Bundles in the Resources List pane on the right.
- A Bundles with a version variable becomes dark gray and can be expanded to show a list of version variables.
- Right-click or double-click slowly to rename the bundle or bundle folder.
- If a Bundle has any errors, warnings, or informational prompts, an icon appears on the right side of it. Hover over the icon to see more detailed information.
- If a bundle contains at least one scene (which makes the bundle a "scene bundle") and also contains non-scene resources, the "error" tag is added. The Bundle will not be built until you resolve the error.
- Bundles that contain duplicate resources are added a warning flag.
- An empty Bundles will be added to the "info tip" tag. For many reasons, empty Bundles are very unstable and can sometimes disappear from the list.
- The Bundles folder has all the informational hints for the included Bundles.
- To resolve the duplicate resource warning, you can take the following methods:
① Right-click on a separate bundle to transfer all duplicate resources to a new bundle.
② right-clicking on multiple Bundles, you can choose to transfer all duplicate resources to a new bundle, or simply transfer them to a new bundle of resources that are duplicated from each other.
③ You can also drag and drop duplicate resources into the bundle list pane directly from the Resource list pane and move them into a bundle. More information on this method can be found in the following resource List feature description.
- Right-click or click the DEL button to delete Bundles.
- Drag and drop Bundles, move them into or out of the folder, or merge them.
- Drag resources into Bundles from Project Explorer to add them.
- Drag resources to a blank space to create a new Bundle.
- Right-click to create a new bundle, or bundle folder.
- Right-click to select Convert to Variant (converted to version variable Bundle). This adds a version variable to the selected Bundle (the default is called "Newvariant"). All resources in the selected bundle will be moved into this new version variable bundle. In the future there will be the mismatch detection between the version variable Bundles (think twice: now there is a warning detection if the number of resources in the two version variable Bundles or the name is not the same (because the resources in the two version variables Bundles should be identical in addition to the compressed format of the resource).
Icons for standard bundles:
Icon for the scene Bundle:
Bundle Details
The lower-left pane shows the details of the Bundles selected in the Bundle list. This pane will display the following information:
- The entire Bundle size. This is the sum of all the resources on the disk.
- The current Bundle depends on the Bundles.
- Any information about the current Bundle (Error/warning/prompt).
Resource List
The upper-right pane provides a list of resources for the Bundles selected in the Bundle list. The following features are available:
- View all resources that are expected to be included in the Bundle, sort by the header information for the list (there are three sorting options: Resource name/bundle name/size, manual click).
- View all resources that are explicitly included in the bundle, that is, the resources that are explicitly assigned to the bundle. The inspector will reflect what the bundle contains, and you will see the bundle name next to the resource name.
- View all resources that are implicitly included in the Bundle. The Bundle name next to these resource names is auto. If you view these resources in the inspector, you will find that their Bundle configuration is None.
① These resources can be added to bundles because resources within bundles depend on them. Only resources that are not explicitly configured Bundle will be implicitly included in other Bundles.
② Note: An implicit inclusion list is not necessarily complete. Known materials, textures are not always displayed correctly.
③ because multiple resources can depend on the same resources, it is common for a resource to be implicitly included in multiple Bundles. If the tool detects this, these Bundles and resources are flagged with a warning.
④ to solve a recurring problem, you need to manually move the resource out, put in a new bundle, or right-click the bundle and select one of the "Move duplicate" options.
- You can drag resources from the Project window into the Bundle on this pane. Only a bundle is targeted, and the resource type is consistent with the bundle type (such as dragging scenes onto the scene Bundle) to be dragged successfully.
- Drag explicit or implicit resources from the list of resources to the bundle list, add them to different Bundles, or create a new bundle.
- Right-click, or press the DEL key to remove the selected resource from Bundles (only removed from Bundles and not removed from the project).
- Select or double-click the resource to locate it in the Project window.
When you include a folder in Bundles, you need to be aware of it. It is possible to drag a resource folder directly from the Project window to the Bundle. When you do this, the folder itself is explicitly contained, and the contents of the folder are implicitly contained. This reflects the priority of assigning resources to bundles. For example, if your game has five prefabs under Assets/prefabs, one of the Prefaba is explicitly assigned bundles, and then you drag the Prefabs folder to the Bundle pane, then Prefaba will automatically generate a Bund Le, the other four prefabs and folders together generate a Bundle named after the lowercase name of the folder.
Resource Details
The lower-right pane shows the details of the selected resource in the resource list. This pane does not interact and is used only to display the following information that may appear:
- The full path of the resource
- If it is implicitly contained, the reason for the implicit inclusion is shown (for example: is auto included in bundle (s) due to parent (s): TestFolder. Implicitly included because of a parent-child relationship)
- If there is a warning, the cause of the warning is displayed
- If there is an error, show the cause of the error
Possible problems and solutions
- Cannot rename or delete an explicit Bundle. This issue occasionally occurs when you first add this tool to an existing project. You need to force re-importing your resources through the Unity menu system to refresh the data.
The Build window uses
The build window provides basic build functionality so you can start using Assetsbundles. In most professional usage scenarios, developers no longer need more advanced build steps. If this does not meet your needs, you can review this tool to build the relevant code and rewrite them. Window-related interactive interfaces:
- Build Target-bundles the platform that will be built.
- Output path-Saves the path to the built Bundles. The default path is assetbundles/. You can manually edit the path, or select "Browser" to select the path. To return to the default path, click the "Reset" button.
- Clear Folders-Deletes all data for the folder under the build path before it is built.
- Copy to Streamingassets-after the build is complete, copy the results to
The assets/streamingassets directory. This can be used in testing, but it does not work in the product.
- Advanced Settings
①compression-Select a compression method in the uncompressed, LZMA compression algorithm, LZ4 compression algorithm.
②exclude type Information-contains no types information in Assetbundles.
③force Rebuild-Rebuild the assetbundles that need to be built at build time. Unlike the "Clear Folders", Bundles that are not included at build time are not deleted.
④ignore type tree changes-ignores the variation of the type trees when an incremental build check is performed.
⑤append Hash-Adds a hash to the Bundle name.
⑥strict Mode-In the middle of the build, if there are any errors, terminate the build.
⑦dry Run Build-Dry run builds.
⑧build-Start building.
(Think twice: Assetsbundles related content is over.) Later see other relevant content will be added as a supplementary content. The following will continue to translate the contents of other parts of the official manual, depending on the importance and difficulty to choose, article 2 Goodbye! )
If this article is helpful to you, please click to praise or comment!
Next Chapter: "Unity3d Technical Document Translation" Article 2 Overview of materials, shaders and textures
"Unity3d Technical Document Translation" article 1.9 using Unity assetbundle Browser tool (end of Assetbundle series)