AnimationEventsDemo.cs
using UnityEngine; public class AnimationEventsDemo : MonoBehaviour { //no parameter public void TriggerEvent() { Debug.Log("event triggered"); } //float parameter public void ScaleDownEvent(float scale) { transform.localScale = new Vector3(scale, scale, scale); } //int parameter public void ScaleUpEvent(int scale) { transform.localScale = new Vector3(scale, scale, scale); } //string parameter public void PrintLogEvent(string str) { Debug.Log(str); } //Object parameter public void SpawnObjectEvent(Object gameObject) { if (gameObject != null) Instantiate(gameObject); } //multiple parameters(float,int,string,object) public void MultiParamEvent(AnimationEvent e) { Debug.Log(e.floatParameter + "," + e.intParameter + "," + e.stringParameter); if (e.objectReferenceParameter != null) { Instantiate(e.objectReferenceParameter); } } }