[Unity] A brief talk on Assetbundle dependencies packaging and loading

Source: Internet
Author: User

a . write in front

It is convenient to manage resources through assetbundle. There are many kinds of packaging and loading strategies for assetbundle, this article describes a way to load resources in a specified directory by using a resource name. It is intended to deepen the understanding of resource management.

two . Strategy Introduction

1. The strategy of Packaging granularity Division

① all files in the specified directory, i.e., RootList, are packaged as separate nodes.

② for all resources that RootList relies on, that is, deplist, where the number of dependencies is greater than 1, is packaged as a single node, equal to 1, and merged up to the dependent node.

③ Recording Packaging information

2. Download Policy

① Download configuration file

② Update Assetbundle file

3. The loaded Policy

① resources corresponding to the hint does not exist, report no exception, if there is a transfer down

②hint reference number increased, dependent hint reference number increased

③ if the bundle in the hint is empty, load the bundle and load the bundle that is not loaded in the dependent hint

④ if hint inside Mainasset is empty, load mainasset

⑤ return hint inside mainasset

4. Release policy

① resources corresponding to the hint does not exist, report no exception, if there is a transfer down

② all dependent hint reference number minus 1, corresponding hint reference number minus 1

③ if hint is a reference number of 0 o'clock, empty mainasset and call unload (true) to the bundle

three . Note

1.Assetbundle when loading its own asset, it is necessary to ensure that all resources have been loaded within this bundle or in other assetbundle that are loaded to ensure that the load is completely correct.

2. When you package resources, you can filter them, and filter out the non-packaged types or the specified resources.

3. Extensible: Record file MD5 change, make incremental package.

4. This method can minimize Assetbundle load resource memory consumption, but increase the number of assetbundle.

Four. Source code

Monsterabsystem

[Unity] A brief talk on Assetbundle dependencies packaging and loading

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.