A plugin that allows you create gui button with circle layout.
Add url below to Package Manager.
https://github.com/JohnsonChenz/CircleScroller.git?path=Assets/Plugins/CircleScroller
- Drag control with Mouse/Touch is supported.
- Works on canvas with all render mode(Overlay/Camera/World Space).
Example is also importable in package
- Right click "Create -> CircleScroller -> TplScripts -> TplCircleButton" to create script template of Circle Button.
- Customize your Circle Button script.
- Create a ui prefab, add your Circle Button script on it.
- Open your scene,find or create a canvas that you prefer to use to render your Circle Scroller,create a empty object under it.
- Add CircleScroller.cs to the empty object.
- **Important** Choose your canvas find type on the inspector (Find with tag or name).
- **Important** Set the Canvas Find Name according to your canvas find type (Find by tag = canvas's tag name, name = canvas's gameobject name)
- **Important** Assign your circle button prefab to the Circle Button Prefab field.
- Modified the rest of the values based on your need. (I suggesting user to modified them in in playmode to see the actual display)
private CircleScroller _circleScroller;
privtae void _InitCircleScrollerExample()
{
// Clear data and display first (Optional)
this._circleScroller.Clear();
// Create 5 Circle Button
for (int i = 0; i < 5; i++)
{
// Create circle button data
YourCustomCircleButtonData yourCustomCircleButtonData = new YourCustomCircleButtonData();
/*
* Setup your custom circle button data...
*/
// Add circle button data into CircleScroller
this._circleScroller.Add(yourCustomCircleButtonData);
}
// Refresh CircleScroller display based on your set-up data.
this._circleScroller.Refresh();
// Snap to target circle button by specific button index (The index depends on the order of Circle Button List)
this._circleScroller.SnapToCenter(0);
}
This library is under the MIT License.