Search Unity

Fill a slider with a custom picture

Discussion in 'UGUI & TextMesh Pro' started by w4ssup, Feb 17, 2016.

  1. w4ssup

    w4ssup

    Joined:
    Feb 16, 2016
    Posts:
    34
    So I'm trying to make a ammo counter (like Halo 3) and I'm trying to achieve this with the slider, but is this correct way? and how Do I make the slider filled with repeating image of a bullet?
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    I thought halo had the ammo as numbers on the weapons?
     
  3. w4ssup

    w4ssup

    Joined:
    Feb 16, 2016
    Posts:
    34
  4. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    Hi, @w4ssup - It's doable.

    Just change the slider Fill item Image Type to "Filled" Fill Method "Horizontal", Fill Origin "Left" - for example. This works if you have image with full row of repeating pattern. IMO you don't even need slider, as you could just use image component, but it seems like slider notices this image mode, and moving from 0-1 animates fill.
    But if you just have one bullet image, you have to mess with import settings of bullet texture I think, as there is no tiling in settings of UI Sprite, and then set the Fill mode of slider Fill item to "Tiled".
     
  5. unity_7BD88DB5C704034C93C0

    unity_7BD88DB5C704034C93C0

    Joined:
    Jan 9, 2024
    Posts:
    11
    How does this work?
     

    Attached Files: