Getting Started
Last updated
Last updated
How to use / Examples
Continuous press event Attach ‘GSUISmartButton’ to the same game object where ‘UI.Button’ is attached.
Button field will be automatically filled when Unity starts or you can assign it manually. ‘GSUISmartButton’ will trigger the button event from Button component that is assigned here like the image below.
Then check ‘Is Continuous’, make sure ‘Is Long Press’ is unchecked. Both can’t be used at the same time.
Initial Delay: wait time until first press event trigger Min interval: interval will be shorter over time Max Interval: Start interval Ease Time: time until it reaches min interval followed ease curve
Long press event Initial set is the same as continuous press event
Check ‘Is Long Press’ and make sure ‘Is Continuous’ is unchecked. Both can’t be used at the same time.
LongPressTime: this is waiting time(sec) until press event trigger
‘GSUISmartButton’ will fire the OnPressing event with elapsedTimeNormal while the user is pressing the button. elapsedTimeNormal has 0-1 value until press event trigger so you can use this value to visualize various indicators to show if the time is done.
Custom enabled/disabled graphic
Colors used for enabled/disabled. When SetDisabled is called, GSUISmartbutton try to change colors depending on disabled param. You can set multiple Image/Text objects to set Normal/Disabled Color and it will override default Button transition behavior.
Loading in the button
The GameObject from this field will be active when SetLoading is called. Button disabled automatically when the state is ‘IsLoading’, you can set the state back by calling either SetLoading(false) or SetDisabled(false) Global button event handle with tracking This is optional but very useful to make a common button event handling feature such as play common button sound/haptic and tracking button id for analytics.
First, you need to create a GSUIButtonManger ScriptableObject.
Then assign this to the GSUISmartButton component that you want to have a button press event. You can create more than one scriptable object to have different button groups. Set Tracking Id what you want to have for a press event. If it is not set, it will automatically use the GameObject name.
As a final step, listen to the OnSmartButtonClicked event from GSUIButtonManger in any class you want to take care of the common button event. This event will pass a GSUISmartButton reference that is pressed and then you can get tracking id from GSUISmartButton.trackingId property.