Streaming Page Config

Synopsis

Often you can face the problem that your result package size is huge, this happens because you can not use compressing on your source coloring book textures, so unity won't apply any compression and one texture could take 2-3 mb even if source png file is just 300 kb.

To fix this problem you can save textures as raw png files at streaming asset folder, so they will included to package as is, and when you need it it will create Texture2D runtime from source png file.

Step by step guide

  1. Create StreamingAssets folder at your project and place your images there

    you can see that Unity even don't allow you to change any import settings, as this files goes to package as is

  2. Create StreamingAsset page config and setup file paths

    Then you need to setup parameters. Check following screenshot and description

Name

Description

UniqueID

unique Id across all page config

StartImagePath

This image is standard texture (not from streaming config), If you don't need default texture, just live it blank

Icon

Icon is a Sprite, Usually you use this in gui, so it's better if unity compress all icons in to one atlas.

OutlinePngPath

This is path to out file, if you use subfolders, you need to provide full relative to "StreamingAssets" folder path

RegionPngPath

The same as outline but for png

Now you can use this page config as usual, but final size per one page will be less than one megabyte

Important Notice

This is experemental feature, and right now it has a bug which will be fixed on the next release.

You can see that StreamingColoringPageConfigdoes not unload loaded textures properly. That's mean that if this texture loaded once it will live in memory forever.

To quick fix that you need to add following method to the StreamingColoringPageConfig.cs

public void ClearTexture()
{
outlineTexture = null;
regionTexture = null;
}

and call this method when you finish drawing and open gallery.