1, Substitute AssetBundle URL in the server into variables
2. Download and cache with UnityWebRequestAssetBundle.GetAssetBundle
3. Make it available on Unity with AssetBundle.getContent
4. When the same scene is loaded, the same AssetBundle will be downloaded because the URL remains the same, and this will lead to an error.
I studied AssetBundle caching, but I don't know how to use AssetBundleManifest.
There are two manifest files and I don't know how to use them.
Investigating that "AssetBundleCache is assigned to the argument" when caching, but Hash value can not be obtained from Manifest file, Hash value of 000000000000 is put
var webreq = UnityWebRequestAssetBundle.GetAssetBundle (url, cache, 0);
// No value is assigned to variable cache
assetBundleCache = DownloadHandlerAssetBundle.GetContent (webreq);
/ * Reloading Scene already downloads the same file
The AssetBundle '--URL--' can't be loaded because another AssetBundle with the same files is already loaded.
*/
-
Answer # 1
-
Answer # 2
The cache is not relevant.
Asset bundles can be downloaded from the network or read from a file, butthings with the same name cannot be read at the same time.When you have finished using the asset bundle, call AssetBundle.Unload method to discard it, or make it possible to see across scenes as sakura_hara says, or check loaded asset bundles with AssetBundle.GetAllLoadedAssetBundles method Please lend.
Related articles
- c # - download process rarely fails
- c # - i want to download an aspnet csv file
- i want to download a file from a bucket using a uri in c # with a format starting with s3: //
- c # - i want to place a control inside a control that has already been placed with style
- c # file download is not successful while outputting mouse operation event
- c # - "an item with the same key has already been added" error when pairing with mac
- c # - to include an instance of your own subclass in assetbundle
- c # can not download from chrome when in headless mode
- c # - download from web server getbytearrayasync downloadfileasync
- [powershell or c #] i want to download a zip file that can be downloaded with a browser from a certain url
- c # - player production in unity (shooting game)
- c # - i want to update the value
- c # - object is not generated in unity sound game production
- c # - [unity] an unintended transition occurs in the state transition of animator controller
- c # - i want to use addvectorobs ()
- c # - unity2d 2d action suddenly i can't move horizontally
- c # - no value is assigned when using if statement
- c # - variable length cannot be used
- c # - i want to play animation to unity music
- c # - programmatically find the coordinates of points in unity overtime
In short, even if the scene changes, it is only necessary to keep the variable (or each class), so it can be done with either of the following.
Make static variable
Use
DontDestroyOnLoad
so that the GameObject with this script does not disappear when moving the scene, and always use this instance when accessing AssetBundle