• Unity
  • How to trigger animation on click

I tried to google this but didn't have any luck. Sorry if it's a very basic question.

I have an object with 2 animations. One of them plays at start and loops. I'm trying to trigger the second animation when the object is clicked. Can anyone tell me how this is done - or point me in the direction an explanation? I'm using skeletonGraphic(UI), if that matters at all. Thank you!

Related Discussions
...

Welcome to the Spine forum!

The example scene Spine Examples/Other Examples/Outline Shaders would be helpful. This scene demonstrates the outline shader, but it also shows how to change the animation when the mouse hovers over the Spine skeleton. To make the animation start when the skeleton is clicked, you can use the Pointer Click event type instead of Pointer Enter in the Event Trigger component.

How to detect mouse clicks is knowledge on the Unity side, so please check the Unity manual:
https://docs.unity3d.com/2021.3/Documentation/Manual/EventSystem.html
https://docs.unity3d.com/2021.3/Documentation/Manual/script-Physics2DRaycaster.html
https://docs.unity3d.com/2021.3/Documentation/Manual/script-EventTrigger.html

Hi Misaki thank you for the welcome^^ And thank you for the help - I'll check this scene out today.