• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by rdxtalha103 · Dec 19, 2022 at 03:12 PM · unity 5assetbundlepluginmemorycache

Addressable cache related issues facing

Is Addressable always a request to the server for the assets in initialization, or does it save them permanently in the cache until the user deletes the game from the mobile device, or does the cache only remain until the user opens the application?

Comment

People who like this

0 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image

Answer by AshwinTheGammer · Dec 19, 2022 at 04:43 PM

The behavior of the Addressable cache in Unity depends on the settings you choose for your Addressable Assets and the cache server configuration.

By default, Addressable Assets are downloaded and stored in the cache on demand, when they are first accessed by the application. T$$anonymous$$s means that if you have a large number of Addressable Assets and you only use a small subset of them, the cache will only contain the assets that you actually use. The cache is stored in a folder on the device's storage, and it will remain there until the assets are evicted from the cache due to lack of space, or until the user manually deletes the cache or the application.

You can also choose to preload certain Addressable Assets into the cache at startup, using the "Load on Start" option in the Addressable Asset settings. T$$anonymous$$s can be useful if you want to ensure that certain assets are always available to the application without the need for a download.

Additionally, you can configure a cache server to act as a central repository for Addressable Assets, w$$anonymous$$ch can be used to store and serve assets to multiple clients. In t$$anonymous$$s case, the cache behavior will depend on the server configuration and the policies set by the server administrator.

Comment
rdxtalha103

People who like this

1 Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image rdxtalha103 · Dec 20, 2022 at 01:04 PM 0
Share

@AshwinTheGammer
Sir as you guided me, the cache will save in a folder on the device storage. Sir, if I loadassets of spriteSheet from server, and reference copy in the list of Sprite, it's means that list of sprites will save in a storage or will remain in the cache, I didn't understand the concept of it?

avatar image AshwinTheGammer rdxtalha103 · Dec 20, 2022 at 02:49 PM 0
Share

If you use the Addressables system to download a sprite sheet from the server and store a reference to the sprite sheet in a list of sprites, the sprite sheet itself will be stored in the cache on the device. T$$anonymous$$s means that the sprite sheet will remain in the cache until it is evicted from the cache (for example, if the cache becomes full and needs to make space for new assets).

The list of sprites that you create in your Unity project will not be stored in the cache or saved in storage. Instead, it will exist as a data structure in memory w$$anonymous$$le your game is running. Each element in the list will contain a reference to a sprite from the sprite sheet, but the actual sprite data will be stored in the cache.

If you want to persist the list of sprites between game sessions, you will need to save it to storage (e.g. using the PlayerPrefs system) or load it from the server again when the game starts.

avatar image rdxtalha103 AshwinTheGammer · Dec 21, 2022 at 03:57 PM 0
Share

Sir, as I have searched on the internet that I found that cache remains until the user close the application. My concern is I want to download only once and save it in the device, but I am not getting idea how can i save the spriteSheet (w$$anonymous$$ch I am getting from the server at runtime) with addressable. I am accessing with a label and type of the asset is IList, or Texture2D. Or anyt$$anonymous$$ng else what I do for my task? please guide, and sorry if I am bothering you. Thank you

avatar image

Answer by rdxtalha103 · Dec 20, 2022 at 05:52 AM

@AshwinTheGammer First of all, thank you sir for the guidance. Sir, I want that assets download from the server on runtime with the help of addressable at device. And assets will remain in the device

  • until the user clear the cache,

  • or if we upgrade that assets at the server (and then without the new build, the new asset bundle download at runtime),

Can you please guide for t$$anonymous$$s scenario, w$$anonymous$$ch settings I need to do, I haven't found anyt$$anonymous$$ng relevant to my queries?

Thank you

Comment

People who like this

0 Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image AshwinTheGammer · Dec 20, 2022 at 02:47 PM 0
Share

@rdxtalha103 To download assets from a server at runtime and have them remain on the device until the user clears the cache or the assets are upgraded on the server, you can use the Addressables system in Unity.

Here are the steps you can follow to set t$$anonymous$$s up:

Install the Addressables package in your project. You can do t$$anonymous$$s by going to the Package Manager (Window > Package Manager) and clicking the "Install" button next to the Addressables package.

Set up an Addressables group for your assets. An Addressables group is a collection of assets that you want to manage and load together. To create an Addressables group, go to the Addressables window (Window > Asset Management > Addressables) and click the "Create Addressable Group" button.

Add your assets to the Addressables group. You can do t$$anonymous$$s by dragging and dropping the assets from your project window into the Addressables window, or by using the "Add to Addressables" button in the Inspector window for each asset.

Set up a remote load provider for your Addressables group. A remote load provider is a system that handles the downloading and loading of assets from a remote server. To set up a remote load provider, go to the Addressables window and select your Addressables group. In the Inspector window, click the "Add Remote Load Provider" button and select the type of load provider you want to use (e.g. HTTP). You will need to provide the URL of your server and any necessary credentials.

Load your assets at runtime. To load your assets at runtime, you can use the Addressables.LoadAssetAsync() method. T$$anonymous$$s method takes the Addressables label for your asset as a parameter and returns a Promise that you can use to access the asset once it has been downloaded and loaded. example:

 using UnityEngine.AddressableAssets;
 
 // ...
 
 AsyncOperationHandle<GameObject> loadHandle = Addressables.LoadAssetAsync<GameObject>("MyAssetLabel");
 loadHandle.Completed += (op) => {
     GameObject asset = op.Result;
     // Use the asset here
 };
 

Cache the assets on the device. By default, assets downloaded through the Addressables system will be cached on the device so they can be quickly accessed in the future. You can control the cac$$anonymous$$ng behavior of your assets by setting the "Cac$$anonymous$$ng" property in the Addressables window for each asset or group.

Let me know if it works...and accept it as answer

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

262 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Is there a way to paint a texture onto a mesh like in UE4? 1 Answer

Addressable related confusion at runtime (for Unity games)? 0 Answers

why UnloadUnusedAssets doesn't unload a asset? 0 Answers

Unity 5 Asset bundle unloading problem 0 Answers

Resources vs Asset Bundles vs file:// 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges