Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[SOLVED] Adding multiple images to a scroll rect.

Discussion in 'UGUI & TextMesh Pro' started by jsleek, Oct 3, 2014.

  1. jsleek

    jsleek

    Joined:
    Oct 3, 2014
    Posts:
    61
    Hi there,

    I'm trying to create a dynamically populating scroll rect, so that all the images i load into the scroll are displayed one after another.

    The problem I have , is that the scroll rect currently only displays enough room to show one full image, rather than having the scrollbar work and being able to scroll down to see all the images loaded in.

    Here's a couple pictures.
    http://imgur.com/a/AQ7Is

    Can anyone help?

    I'm happy to answer any questions regarding more detail, but please be aware I'm a novice.

    Cheers.
     
    Dois likes this.
  2. ChoMPi

    ChoMPi

    Joined:
    Jul 11, 2013
    Posts:
    112
    Use Vertical Layout Group with a Content Size Fitter as content holder.
     
    Last edited: Oct 3, 2014
  3. jsleek

    jsleek

    Joined:
    Oct 3, 2014
    Posts:
    61
    Thankyou, i had never heard of that! I will give it a go and report back.
     
  4. jsleek

    jsleek

    Joined:
    Oct 3, 2014
    Posts:
    61
    I gave it a go but I couldn't get it to work. Do you think you could, from scratch, explain exactly how you would do it?
    Cheers!
     
  5. ChoMPi

    ChoMPi

    Joined:
    Jul 11, 2013
    Posts:
    112
    I've made a little scene for you, just open it up and check out the hierarchy.
     

    Attached Files:

  6. jsleek

    jsleek

    Joined:
    Oct 3, 2014
    Posts:
    61
    Thankyou! I combined your scene with my script to make a working dynamic scroll list! I've attached it in this post. The scroll in the top right is the one that is dynamic.
     

    Attached Files:

  7. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,042
    ChoMPi, thank you for that sample - just what i was looking for. Coming from EZ GUI - UGUI needs more manual setup but i am liking it so far