Resource memory management scheme based on unity5.x version

Source: Internet
Author: User

1, unity on the management of resources API summary:

Resources:load, Loadall, LoadAsync, Unloadasset, Unloadunusedassets.

Assetbundle:loadfromfile, Loadfromfileasync, Loadfrommemory, Loadfrommemoryasync, Loadallassets, LoadAllAssetsAsync , Loadasset, Loadassetasync, Unload (True/false).

Gameobject:instantiate, Destroy, Destroyimmediate.

The above API is unity5.x almost all the memory resource management interface, all the memory management scheme is almost all implemented with the above interface.

2. How to load the file:

Loading of files within resource: Resources.load, Resources.loadall, Resources.loadasync

Supports synchronous loading of in-Package loading mode: Assetbundle.loadfromefile

Common synchronous Loading mode: Assetbundle.loadfromfile, File.Open

Common asynchronous methods (both in-package): Assetbundle.loadfromfileasync, new www, www.LoadFromCacheOrDownload

3. Compare several loading Assetbundle modes:

The advantage of this way of loading a resource file with new www is that it is not limited by the iOS platform 256 file handle, and the disadvantage is that it takes up more memory than other methods when it loads resources in this way. For Www.LoadFromCacheOrDownload this way, it takes up less memory and is in serializefile format in memory, but it is limited by the upper limit of the iOS platform 256 file handle. After unity5.3, however, Assetbundle.loadfromfileasync and www.LoadFromCacheOrDownload will be loaded automatically if the upper limit of the handle is turned into new www.

4, Assetbundle loaded into the memory state diagram:


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.