Understood! So.. something like this could work? .. or am i barking up the wrong tree here?
public class ClipEvent
public string name;
public int key;
public float fireAt;
This would then be on a animationManager where i reference all the AnimationReferenceAssets and pair them up with their corresponding state so i can fire of animations from my statemachine.
I would then, when setting that up - also add all relevant events.
public void SetEvents(AnimationReferenceAsset asset)
Spine.EventTimeline newTimeline = new EventTimeline(asset.Animation.Timelines.Items.FrameCount);
foreach (ClipEvent evnt in events)
Spine.EventData eventData = new EventData(evnt.name);
eventData.Int = evnt.key;
Spine.Event newEvent = new Spine.Event(Mathf.Lerp(0, asset.Animation.Duration, evnt.fireAt), eventData);
newTimeline.SetFrame(Mathf.RoundToInt(newEvent.Time / 30), newEvent);
Havent tested this yet, but a few questions that pops up is how to handle the framecount for the timeline, as the events are added with a reference to time in floats.