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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Rounded-Ends UI Bar

Discussion in 'UGUI & TextMesh Pro' started by ExbowFTW, Jun 26, 2017.

  1. ExbowFTW

    ExbowFTW

    Joined:
    May 2, 2015
    Posts:
    281
    How would I make the ends of a Radial Bar rounded?
    Note: I am not asking how to make the Image Type "Radial"!

    Example:
    Currently, my radial bars look like this: [Squared off ends]
    Screen Shot 2017-06-25 at 6.25.43 PM.png

    I want to make it like this: [Rounded Ends]
    Screen Shot 2017-06-25 at 6.25.56 PM.png

    Thanks!!!
     
  2. tsangwailam

    tsangwailam

    Joined:
    Jul 30, 2013
    Posts:
    280
    Simple to add a circle at the end.
     
  3. ExbowFTW

    ExbowFTW

    Joined:
    May 2, 2015
    Posts:
    281
    But how would you add a circle to the end? Sure, you could add a RawImage of a circle, but it wouldn't move with the Bar unless there was a script - do you know of any scripts to do this?
     
  4. tsangwailam

    tsangwailam

    Joined:
    Jul 30, 2013
    Posts:
    280
    how do you create the radial bar? texture?
     
  5. ExbowFTW

    ExbowFTW

    Joined:
    May 2, 2015
    Posts:
    281
    Image Component.
    Image Type = Filled
     
  6. tsangwailam

    tsangwailam

    Joined:
    Jul 30, 2013
    Posts:
    280
    So, you mask out the sector to create radialBar effect? You may just place image on top and mimic the rounded corner.
     
  7. ExbowFTW

    ExbowFTW

    Joined:
    May 2, 2015
    Posts:
    281
    The point of a radial bar is that it moves - search up "Apple Watch Ring Animation" for a good visual on what radial bars do. From what I understand, just placing a image "on top" would not move with the bar.
     
  8. tsangwailam

    tsangwailam

    Joined:
    Jul 30, 2013
    Posts:
    280
    What is the script you use to create the radialbar? You should able to calculate the position of each end of the radialbar.
     
  9. ExbowFTW

    ExbowFTW

    Joined:
    May 2, 2015
    Posts:
    281
    I don't have a script to create the radial bar - it is an Image Component
     
  10. tsangwailam

    tsangwailam

    Joined:
    Jul 30, 2013
    Posts:
    280
    So, just a static image?
     
  11. ExbowFTW

    ExbowFTW

    Joined:
    May 2, 2015
    Posts:
    281
    Yes, it is an image of a Ring. Making the ImageType "filled" makes it into a Radial Bar.
     
  12. tsangwailam

    tsangwailam

    Joined:
    Jul 30, 2013
    Posts:
    280
    Oh. I know how you do it. You may need extract script to doing what you need.
     
  13. ExbowFTW

    ExbowFTW

    Joined:
    May 2, 2015
    Posts:
    281
    What is extract script?
     
  14. prasanthvel

    prasanthvel

    Joined:
    Aug 21, 2017
    Posts:
    7

    try this