To access the int, float, and String data from an event in Spine using the spine-godot runtime, you can use the event
object passed to the _on_animation_event
function. The event
object provides methods to retrieve the event's data. Here's how you can access these values:
func _on_animation_event(_spine_sprite: Object, _animation_state: Object, _track_entry: Object, event: Object) -> void:
match event.get_data().get_event_name():
"event":
var int_value = event.get_int()
var float_value = event.get_float()
var string_value = event.get_string()
print("Int value: ", int_value)
print("Float value: ", float_value)
print("String value: ", string_value)
In this code, event.get_int()
, event.get_float()
, and event.get_string()
are used to retrieve the integer, float, and string values associated with the event, respectively.