Reputation: 582
I'm working on cross-platform mobile Unity application. I want add a switch on my screen allowing user turn on and off some functionality (like this: Android Material Switch).
As I know there is no native implementation of UI Switches in Unity. I found only this asset (Switch UI element) in Unity Asset Store, but it has really poor design.
So should I manually implement the Material Switch? Or is there anything in the web I can use in this case?
Thanks for response.
Upvotes: 1
Views: 4768
Reputation: 516
Probably I'm a bit late, but for anyone who is viewing this question, I found a fairly good (free) Asset called Lean GUI with switches and stuff.
Hope it'll help someone.
Upvotes: 2
Reputation: 10750
You can use slider as switch.
Here are simple steps:
Register "OnValueChange" method to handle change in value:
public void SliderValueChanged(float value)
{
if(value == 0)
// off
else
// on
}
Upvotes: 7