When you load an asset from a bundle, the bundle's reference count increases and when you release the asset, the bundle reference count decreases. (Released assets can also be unloaded by calling Resources.UnloadUnusedAssets, but that tends to be a slow operation which can cause frame rate hitches.)ĪssetBundles have their own reference count (the system treats them like Addressables with the assets they contain as dependencies). The memory used by an asset is not freed until the AssetBundle it belongs to is also unloaded. Note, however, that released assets are not necessarily unloaded from memory immediately. You can release an asset with a reference to the asset instance itself or with the result handle returned by the original load operation. The basic rule of thumb to avoid "memory leaks" (assets that remain in memory after they are no longer needed) is to mirror every call to a load function with a call to a release function. When you explicitly load an Addressable asset, you must also release the asset when you are done with it. When the reference count of an Addressable returns to zero, it is eligible to be unloaded. ![]() ![]() When an Addressable is loaded, the system increments the reference count when the asset is released, the system decrements the reference count. The Addressables system manages the memory used to load assets and bundles by keeping a reference count of every item it loads.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |