Custom Events
For all the events not handled natively in Surfer, we can use CustomEvents
: events that we send to Surfer in order to let SUElementCanvas
/SUElementsToolkit
handle them.
Animator
An example of custom events can be done with the Animator
.
Basically :
let's add the component
SUAnimatorBehaviour
to an animator state machineselect if the behavior should run on the Animator State Enter or Exit mode
create an action
SendCustomEvent
and choose an event from the dropdown listadd
SUElementCanvas
to whatever scene object (for UIToolkit setup aSUElementsToolkit
component and add a new element data) and , as event , selectMyCustomEvent
and then choose the event name chosen in the step above
Now , you can react to an Animator State Enter or Exit event as you wish.
LeanTouch
An example of custom events can even be LeanTouch
.
Basically :
- let's add the component
LeanFingerTap
to a scene object - let's add to the same object the component
SUAction
: now create aSendCustomEvent
action and choose an event from the dropdown list - in the public event
OnWorld
of LeanFingerTap , drag the SUAction component in it and select thePlay
method
- add
SUElementCanvas
to whatever scene object (for UIToolkit setup aSUElementsToolkit
component and add a new element data) and , as event , selectMyCustomEvent
and then choose the event name chosen in the step 2
Now , you can react to a LeanTouch event as you wish.