- Home /
Managed to find an answer myself
Max Size of Textures from AssetBundle
Hey all,
I am building a small application where players can view a variety of 360 degrees photos on a GearVR. I decided to use AssetBundles to reduce loading times and decrease the size of the apk.
Everything seems to work fine, the only issue I have is that the MaxSize of the texture I load from the AssetBundle are set to 2048 instead of 8192.
I have changed all of the ImportSettings to match the settings I need, and use the TextureImporter to automatically import all textures using the correct settings.
class MyTexturePostprocessor : AssetPostprocessor {
void OnPreprocessTexture() {
TextureImporter textureImporter = (TextureImporter)assetImporter;
textureImporter.maxTextureSize = 8192;
textureImporter.mipmapEnabled = false;
}
}
My Assetbundles are build as UncompressedAssetBundles and Builtarget Android.
BuildPipeline.BuildAssetBundles("Assets/ABs", BuildAssetBundleOptions.UncompressedAssetBundle, BuildTarget.Android);
I use LoadAssetAsynch too load the textures when I need them.
IEnumerator SetImage(string url, string imageName) {
Texture2D tex = new Texture2D(7776, 3888);
WWW www = WWW.LoadFromCacheOrDownload(url, 1);
yield return www;
AssetBundle bundle = www.assetBundle;
AssetBundleRequest request = bundle.LoadAssetAsync(imageName, typeof(Texture2D));
tex = request.asset as Texture2D;
manager.currentTexture = tex;
bundle.Unload(false);
www.Dispose();
yield return null;
}
Is there anyone who has experienced the same issue, or can help me solve this issue?
Regards, Wilco
Answer by wilmaster1 · Oct 22, 2016 at 09:09 PM
I managed to fix it, I played the code where I did not define the Texture2D size. Doing so fixed my problem.
Follow this Question
Related Questions
[Edited]Access photos from gallery in application (Android) 1 Answer
Asset bundles caching.IsversionCached() always returns false 1 Answer
How do I include added dll's to a android apk build? 1 Answer
android app: load a local image into texture by WWW class 0 Answers
What format will allow me to copy a texture on Android in real time? 1 Answer