From 3a506300ebe6cd138edae7d5d9c3bb1bff0766f4 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Mon, 19 May 2014 21:19:43 +0200 Subject: [PATCH] Show using a lambda for callbacks. --- spine-unity/Assets/examples/spineboy/Spineboy.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spine-unity/Assets/examples/spineboy/Spineboy.cs b/spine-unity/Assets/examples/spineboy/Spineboy.cs index 86921e512..60d478ce9 100644 --- a/spine-unity/Assets/examples/spineboy/Spineboy.cs +++ b/spine-unity/Assets/examples/spineboy/Spineboy.cs @@ -41,6 +41,10 @@ public class Spineboy : MonoBehaviour { skeletonAnimation = GetComponent(); // Call our method any time an animation fires an event. skeletonAnimation.state.Event += Event; + // A lambda can be used for the callback instead of a method. + skeletonAnimation.state.End += (state, trackIndex) => { + Debug.Log("start: " + state.GetCurrent(trackIndex)); + }; // Queue jump to be played on track 0 two seconds after the starting animation. skeletonAnimation.state.AddAnimation(0, "jump", false, 2); // Queue walk to be looped on track 0 after the jump animation.