How can one create a Asset Bundle of StreamingAssets? I am trying to do it for an iOS and Android because I “cannot” have it part of the APK/IPA due to the size limit over 3G.
I am able to build the assetbundle from the StreamingAssets folder when the Build Settings platform is set to something other than Android.
(The assetbundle still targets Android)
Problem is the video in the assetbundle is not streaming…
Has anyone found a way to build a bundle containing video files to a mobile device?
We are using MobileMovieTexture to play our videos, but don’t want the videos bloating the app size. So we would like to build them to a bundle, then download them over the web at runtime.
I’m assuming there is a way to do this? Would seem an unnecessary limitation if Unity disallows video files in mobile asset bundles.
timsk you are missinterpreting the situation or don’t seem to understand what StreamingAssets actually does.
You can not include video files for mobiles.
As the error says, movie textures are not supported on mobile and the only thing Asset Bundles can contain are Unity Asset objects. This is what MovieTexture is, but a file in StreamingAssets isn’t. Unity can and will not transport anything but its known asset types through AssetBundles (as its name implies)
Thats why StreamingAssets was brought into the mix.
StreamingAssets does copy over your movie 1 : 1 as added, its not touched by Unity in any form and especially not ‘removed as file and integrated into the assets’, which would happen with Asset Bundle data for example.
The movie playback that happens on the device requires the file to be present as file so the iOS / Android movie player can use them, Unity gives you no movie playback capabilities at all on its own, it only offers you what the OS offers I fear. MobileMovieTexture has this very limitation as well as they rely on the movie playback hardware support, otherwise your game would run at 5fps.
What you can do is not include the movie in the build and download it later.
But for that you don’t need AssetBundles.
You can just put the file online, download it with WWW and then use System.IO.WriteAllBytes(www.bytes,Application.persistentDataPath + “/MyCoolMovie.mp4”); to store it and reference it by that path later on.
I understand I could just download the file and use IO to store it, but we are planning on using quite a few videos and it would be handy to be able to use AssetBundles, as we do with all our other assets. Rather than have to create a separate system for just video assets.
I suppose the clue is in the name AssetBundle :). What I want is a FileBundle. Time to look into compression methods then!