2D Circle Sprite Question

Hello everyone,
I am kinda new in unity/c# and after following several tutorials on the internet, i began working on my own project.
The thing that stopped me and brought me here is trying to create a circle sprite which is divided into x equal parts, each with it’s own random colour (something like a pie-chart).
Can you guys give me some advice in achieving this?
Thank you very much!

@MyXtreme12

If you don’t need to dynamically change the colors, why not just create it in your art software, or use a quadrant, rotate it to each 4 orientations, and apply different colors and the group the quadrants under one parent transform.

Because I need to change the x value (amount of circle parts) with each level so it will take a lot of work to do this for say 50 levels.

@eses

Well… why didn’t you put that in your OP?

What do you mean by that? Be more explicit please, thank you.

“What do you mean by that? Be more explicit please, thank you.”

@MyXtreme12

You are pretty much posting your first question, so you should familiarize yourself with how to write a good question - see scripting area pinned thread.

Your original post / question pretty much only contained this info:

“create a circle sprite which is divided into x equal parts, each with it’s own random colour (something like a pie-chart)”

But, you didn’t care to explain what you actually mean by x equal parts means, and turns out it is actually a changing property, which only became obvious after your answer to my answer…

So that is what I mean = question is really vague, many things are left open;

How many variations of pie chart do you need? Is it arbitrary values every time?

Do you need this for in game stuff or to display some statistical data, or for UI? You can do different things with sprites and UI system, as these are two different things.

So, instead of answering to these questions by me, why not just update the original post to be more specific? So that it is clear what you need, how it should work, and where is it displayed, maybe also add a screenshot or diagram if you think those are needed.

For UI you can use UI image fill, but then again, I have no idea what you are trying to do*.*

Hello,
I apologise for my bad explanation earlier. I indeed did not give much detail about what I want to implement.
The main idea is to build a AA Replica game (the one with a rotating circle as a main object where you had to pin some sticks in it) but improve it in a way that the circle is split into equal parts, each part with a random color. For example, in the first level, the circle would be only one color. In the second level, the circle would be divided into 2 equal parts, each with a different color and you need to pin the sticks in the right color and so on.

Like I said, probably easiest would be to try to use image with suitable fill method… create a script that creates ui images matching the count you need, assign start and end angles in the same loop.

Thank you!