Search Feedback

14
votes

unloadasset() for assetbundles

Assets

-

-

Resources currently has Resources.UnloadAsset()
https://docs.unity3d.com/ScriptReference/Resources.UnloadAsset.html

I would like this function for AssetBundle where it unloads a single asset that was loaded by an asset bundle. The asset bundle should remain loaded, and the unloaded asset should still be able to be loaded from the Asset Bundle.

Usage:
I would like to load assets from the AssetBundle, use them, then remove them from memory, while having the AssetBundle still loaded and having the ability to load any asset from the bundle (including previous unloaded assets).

Currently if you LoadAsset() from an AssetBundle it will stay in memory until you Unload() the entire bundle.

Comments (3)

  1. C26e850a83c5ec28aeeae825dff63b3a?d=mm

    victorluishongchau

    Sep 03, 2018 02:10

    I have tested on 2018.2 and it seems that using Resources.UnloadAsset unloads memory of asset even if the asset comes from an AssetBundle. This should work both for streaming asset or ordinary asset, and both for lz4 or lzma compression.

    Anyone looking at this page is encouraged to check if it is true yourself on your own Unity version.

  2. A722dd133c4ac4309a782b2e485822e9?d=mm

    superbcorperation

    Jul 16, 2018 08:55

    I want AssetBundle.UnloadAsset(asset);

  3. A417e3a2423a8e3210efd5cb201a7e68?d=mm

    Diamonds0a

    May 03, 2018 02:09

    It should be noted that
    Resources.UnloadUnusedAssets() accomplishes this, but is a very expensive function call.

Your opinion counts

Help us make things better. Share your great idea for improving Unity or vote for other people’s.

Log in to post a new idea

Categories

All

(10750)

2D

(281)

Ads

(54)

AI & Navigation

(81)

Analytics

(130)

Animation

(395)

Asset Store

(355)

Asset Store Publisher

(15)

Assets

(543)

Audio

(184)

Cloud Build

(144)

Collaborate

(63)

Docs & Tutorials

(239)

Editor

(2507)

Everyplay

(17)

Game Performance Reporting

(21)

General

(978)

Graphics

(869)

GUI

(430)

Input

(172)

Licensing

(90)

Networking

(188)

Physics

(383)

Platforms

(440)

Profiling & Optimization

(84)

Runtime

(181)

Scripting

(1168)

Terrain

(170)

WebGL

(142)