Search Unity

Loading and displaying a lot of images

Discussion in 'Editor & General Support' started by andyz, Nov 21, 2018.

  1. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,269
    For a non-games project I need to load a lot of images (jpg) and display different ones at different times, helps to keep them cached in memory to avoid reloading. The troublesome platforms are webgl and mobile due to memory constraints.

    I can load the images into Texture2D but then they are uncompressed - I can call compress on Texture2D but for some reason this only works to DXT1 and seems to break webgl presently (and no support on iOS).

    So does anyone have technique to save memory?
    One thought is cache images in jpg format only and turn into Texture2D temporarily when displayed (though no function in API I think).
    Edit - ImageConversion.LoadImage will Load into Texture2D so perhaps best option keep cache of jpg/png byte images in memory
     
    Last edited: Nov 21, 2018