Search Unity

Best practice for creating in-app Gallery

Discussion in 'Scripting' started by zoe_nightshade, Feb 21, 2018.

  1. zoe_nightshade

    zoe_nightshade

    Joined:
    May 12, 2016
    Posts:
    27
    Hello, everyone!

    I'm currently developing an app with an in-app gallery. As of this moment, I am saving the photos the user adds to Application.persistentdataPath. When the gallery page is called, I use FileInfo.GetFiles to get each file in my path then instantiate it as gameobjects to my scene list. This works fine for small resolution images but when I start loading higher resolution images, my app crashes. Same goes when I view the images on my app.

    Any advice would be greatly appreciated.

    Thanks :)
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,409
    Probably out of memory.. (or are you getting some other error in logs?)

    How many images you need to show at once?
    i mean could you load only the one that is visible at a time?
     
  3. zoe_nightshade

    zoe_nightshade

    Joined:
    May 12, 2016
    Posts:
    27
    That seems to be my problem. Seems like the best option would be to lower the rendering of the textures.