Reputation: 43
New to Unity so pardon any mishaps.
Till now I have:
1- created an asset bundle
2- uploaded it to server
3- downloaded the asset bundle
4- extracted objects from the asset bundle and used (instantiated) them "in game" via script.
Now the issue is, after downloading it, could I store the asset bundle in some directory, or for instance, instead of instantiating the game objects, could I save them in some directory as .prefab files. Or am I limited to extract the objects at run-time and "ONLY ABLE INSTANTIATE" them?
Edit: Other answers on this forum do tell how to store the asset bundle as a *.unity3d file. What I want different is not to store the bundle as a single file, but extract its constituents in some directory.
Thanks
Upvotes: 1
Views: 2625
Reputation: 125255
could I save them in some directory as .prefab files.
No. You can't do this because you can't create and load prefab during run-time outside the Editor. The only prefabs you can load are the one created in the Editor and bundled with the game.
One option you have is to download and save the assetbundle as with the ."unity3d" extension as described in this answer.
Another option is to individually convert each file and save them. For example, if the assetbundle contains Textures, convert it to png or jpeg with EncodeToPNG
then save it. You can then load it with LoadImage
. This can be done to audio, video files too by saving them in ".mp3" and ".mp4" format. The videos and audios can be loaded with the UnityWebRequest
API after saving them. This won't work with prefab.
Upvotes: 3