- Home /
Include jpg files without automatically converting to sprites or textures
I've been playing around with Unity and now I want to create a game with lots of pictures. After adding just a few pictures I noticed that the APK starts to be very huge. The jpg files automatically get converted to sprites taking up more than 2MB per picture while the original files are less than 60KB. I only need one picture at a time in the game and speed is not a concern. Is there any way to include the jpg files as they are (just the file as it is instead of converting it to a sprite or texture) and at runtime when I need them convert them to a sprite? I'm using the free version of Unity 4.6 and c#.
Thanks for any help.
Answer by Denvery · Dec 05, 2014 at 04:54 PM
Yes, you can simply change .jpg to .bytes. Then you can use http://docs.unity3d.com/ScriptReference/Texture2D.LoadImage.html to create image from textAsset. This will reduce APK's size.
Thank you for helping. I will try your solution later. Now I'm using a special folder 'Strea$$anonymous$$gAssets'. See http://docs.unity3d.com/$$anonymous$$anual/Strea$$anonymous$$gAssets.html
Please post your feedback about using Strea$$anonymous$$gAssets. Especially about AP$$anonymous$$'s size. It is interesting for me.