I set up an event listener as recommended here: Coding for Spine Events and AnimationState callbacks and I am using latest of Spine 3.7.
And this is my event handler:
void HandleEvent(TrackEntry trackEntry, Spine.Event e)
{
Debug.Log("Bull audio event triggered: " + e.Data.String);
// Play some sound if the event named "footstep" fired.
switch (e.Data.String)
{
case "footstepRun":
Debug.Log("Play a footstep sound!");
break;
case "hoofStomp":
Debug.Log("Play a stomp");
break;
case "crashImpact":
Debug.Log("Play an impact");
break;
}
}
I am testing with the hoofStomp, which I can confirm is in my skeleton.json:
"events": [
{ "time": 0.6, "name": "hoof", "string": "hoofStomp" }
]
The event triggers and works fine if I use e.Data.Name and then compare to "hoof", but e.Data.String returns an empty string / null when the event triggers.
Bull audio event triggered:
UnityEngine.Debug:Log(Object)
bullChargeBehavior:HandleEvent(TrackEntry, Event) (at Assets/Scripts/characters/monsterScripts/bullChargeBehavior.cs:139)
Spine.AnimationState:OnEvent(TrackEntry, Event) (at Assets/Spine/Runtime/spine-csharp/AnimationState.cs:80)
Spine.EventQueue:Drain() (at Assets/Spine/Runtime/spine-csharp/AnimationState.cs:1193)
Spine.AnimationState:Apply(Skeleton) (at Assets/Spine/Runtime/spine-csharp/AnimationState.cs:251)
Spine.Unity.SkeletonAnimation:Update(Single) (at Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs:189)
Spine.Unity.SkeletonAnimation:Update() (at Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs:178)