# Creating Custom Wheel

## Empty Wheel

In the prefabs folder you can find a subfolder called WheelComponents

Drag following prefabs to your scene:

* EmptyWheel
* LUCKY\_WHEEL\_CONFIG
* Wheel UI (optional if you want to reuse it, otherwise you can also create your own UI)

Your scene should look something like this

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXekSjccJYxqHWA4eqZzdwQyaBAkkugmkkDtJNVgTBriWbwAUJ3_0EO4EVvkGL0hkdNGeb2nSK6twn0NlesHlrxYcyHS76N_MudVa0AWq8bOw9XgXgE14zulVzwuJv8Su4-vJEkJ?key=pqA5RXHlJL7kz8oIwzPZXVKS" alt=""><figcaption></figcaption></figure>

## Separators

In the same prefab folder where you found the other wheel components there is a Separator (1) prefab. Depending on how much reward sections you want to create, add X of them to EmptyWheel→Wheel→SeparatorHolder. Then rotate each separator along the Z axis until you get your desired outcome.

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXcYPHDH7KkP4nLa8DlhVTC8EIYt1t0ndYXLCCjXuZ4asgqLp_bEOZAKCuZ2t6JPobZSFvGQnGd7YDfNDwyHZCqhUuyoEYBqyi7myk-64GeMyBashL2WnaeTsXWKOG9XAjKJiOKHOw?key=pqA5RXHlJL7kz8oIwzPZXVKS)

Adding 10 separators, rotating the SeparatorHolderby 18 and rotating each separator by 36 degrees more than the previous one results in following wheel.



<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXf6OhYdzHn-oiR0pcafsf8HovpDHn1Ckc-T5iSCbsLC_ksnJihfuG43L46qYNqysuuRiM1yXTQOhQ0nrm_A40Q_YJUSUmxjXnNeCjuzNTxfNjrppSETlYyiYy8bicLbOq1hN15Q?key=pqA5RXHlJL7kz8oIwzPZXVKS" alt=""><figcaption></figcaption></figure>

Basically what I do is I calculate the rotation by 360 divided by the amount of separators.\
In our case it equals 36. So I set up the separator rotation like 36, 72, 108 etc.\
To offset the separators so no separator is directly under the Pin, i divide the 36 by 2 and use this as the rotation for the SeparatorHolder (which in our case is 18)

\


## Rewards

Now it’s time to add some rewards to it. In the same prefab folder you can find the \
WheelReward (1) prefab drag it to the RewardHolder.\
Click on the added object and in scene view there should appear some handlers for the 2d collider

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfu3mnkQoyRrX29lSZsuJ7aZuf4ZV9CIVFEjsDB2QuhGlM4WRttYx7vYtFHYr3D4Q_19BIG2OC5937-J7_AtRcB_dkZ4xhk18Y1T0EC2-SpST-iVn3f7wDAlqJcpOG7J6jmO45zZQ?key=pqA5RXHlJL7kz8oIwzPZXVKS" alt=""><figcaption></figcaption></figure>

With the green arrows you can move the collider position and with the blue and red cubes you can resize it. Make sure that the collider is between the 2 orange separator knobs and that it is going at least outside of the inner blue circle. So we can make sure that the pin collider detects the proper reward when the wheel stops.



Now duplicate your WheelReward X times. Duplicating in unity will ensure that the next reward number at the end of the name is automatically incremented, so you will have objects ranging from WheelReward (1) until WheelReward (X).

{% hint style="warning" %}
**Please do not delete the number at the end of the reward name.** &#x20;

The wheel component initializer will automatically parse the name, detect this number and assign the proper reward amount and icon, configured in your LUCKY\_WHEEL\_CONFIG.
{% endhint %}

After setting up all rewards it should look something like that:

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdS0CJ9VtDNJ6U7k79B956MWJlhj2PJxB34mLjLuKVwM1ujCIiliQSi9zuaXG8gLb7pnX83zuf3RePSoDOuRdjbYanjbyFb3kjgl3h-eKRFp3pnHiLYYlhPa5afRSg6F7nVG3V0hQ?key=pqA5RXHlJL7kz8oIwzPZXVKS" alt=""><figcaption></figcaption></figure>

## Connect Wheel to UI

Go to the startButton and drag the Wheel component from the empty wheel to the OnClick handler of the button, then select LuckyWheelSpinner.Spin

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXedWsOFdt_6zHqpmtMt4XElczdAo92oxxEwO_oM44i6219bt7vyvIC6xwbGmBTP4KmKzwoqkzaSC--NxDLYzXWFYcUV61GcnsUrAbMTOGBwiHbGwyMbdvWWG49a6dLfka7kZfPQVg?key=pqA5RXHlJL7kz8oIwzPZXVKS" alt=""><figcaption></figcaption></figure>

And that’s it. Congratulations, you have just created your own customized lucky wheel!

\
