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

Question Filling image - radial 360 - with custom starting angle

Discussion in '2D' started by Eleven18, Aug 9, 2023.

  1. Eleven18

    Eleven18

    Joined:
    Mar 25, 2017
    Posts:
    6
    Hi,
    I would like to fill my sprite using radial 360 fill method, but I can choose only 4 corners for start fill angle. Is any way to set custom start angle like blue/purple/green on the attached picture? I checked RadialCut in UI/Image, but I think it's hard coded for only 4 corners. I would like to get the effect that one sprite fills over another sprite giving this kind of pie chart effect where, for example, half of the circle is 1 sprite and the other half another sprite. (It would be good if more sprites could be added).
    upload_2023-8-9_15-20-31.png upload_2023-8-9_15-23-52.png
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
    It's a bit hacky but I always just spin the image itself.

    Code (csharp):
    1. image.transform.rotation = Quaternion.Euler( 0, 0, baseAngleInDegrees);
    Obviously, if you're layering up a pie chart out of a stack of these you have to keep your own notion of angle going around and adding up for each successive pie slice.
     
  3. Eleven18

    Eleven18

    Joined:
    Mar 25, 2017
    Posts:
    6
    Yes I thought about this case, but my images in this "chart" have graphics, they are not a just solid color, so rotation is a good case, but I'm still looking something different :(
     
  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,955
    Kurt-Dekker likes this.
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563