Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

200 Images in one scene

Discussion in 'General Discussion' started by WirealTalha, Aug 21, 2019.

  1. WirealTalha

    WirealTalha

    Joined:
    Jul 19, 2018
    Posts:
    142
    Hi Im creating a simple 2d game and this question is regarding the leaderboard, specifically Profile pictures.

    we have 3 leaderboards, daily, monthly and Friends leaderboards.

    daily has about 50 entries
    monthly has the same 50 entries
    Friends can vary according to your friends list(facebook)

    -->each entry has{Profile picture, country flag, name, Score}

    right now what I'm doing is i have 50 raw images in daily, 50 in monthly and instantiating Entry prefab in friends leaderboard. Im downloading profile pictures from Url(web). and setting the textures at runtime.

    For friends what should I do?I have a list of friendsUrls. I dont think for friends i need to download images each time best case would be to save the pictures on device and use it.

    Q1) Is this current scenario memory efficient? what can i do to make it more memory efficient.
    Q2) What should I do with facebook friends pictures in Friends Leaderboard.
    Q3) any advice would be highly highly appreciated. Let me know what you did to make leaderboards with pcitures.

    cheers.
     
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Is anyone really going to look at fifty pictures at once? Typically you can just grab the pictures around the user, then load more on the off chance they scroll around.

    I would definitely cache the pictures. You shouldn't be burning through the user's bandwidth, or annoying facebook, by redownloading the pic every few moments.
     
  3. WirealTalha

    WirealTalha

    Joined:
    Jul 19, 2018
    Posts:
    142
    Please kindly tell me How should i do it then? I've hit a very strong wall and I cant move an inch. Cant even progress.
    i could do it in a way thats not very optimized but i need optimized solution.
     
  4. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,948
    What? @Kiwasi literally just explained what to do. "you can just grab the pictures around the user, then load more on the off chance they scroll around." and then "I would definitely cache the pictures. You shouldn't be burning through the user's bandwidth, or annoying facebook, by redownloading the pic every few moments."

    That all seems pretty clear to me?

    So to recap:

    1. Dont download all the pics at once, get a small subset based on what they see and a small amount beyond that
    2. Download pictures as the user scrolls if necessary, you can show a spinner on pictures that are still downloading
    3. Cache all downloaded pictures so scrolling back up will instantly show them.
     
    WirealTalha, Kiwasi and zombiegorilla like this.