Hi, can someone please tell me why this does not work, I’ve attached the animation to the player, When I press P it goes to the ThrowFireBall function but nothing happens, no errors, nothing, if I remark it out and just add the Throw animation it works fine, and my fireBall function works fine to … ???

var targetClipName : String = “Throw”; //Where should the Event be added? (the name of the AnimationClip)

var throwTime : float = 0.3; //When should the function be called?

var throwFunctionName : String = “fireBall”; //What’s the name of the function?

function ThrowFireBall() {

var throwEvent : AnimationEvent = new AnimationEvent();

throwEvent.time = throwTime;

throwEvent.functionName = throwFunctionName;



Hi, I’ve sorted it out now,

function Chuk()

// Debug.Log("Length: " + animation[“Throw”].clip.length);

// Create and set up the AnimationEvent
var throwObjectEvent = new AnimationEvent();

throwObjectEvent.functionName = “throwObject”;

throwObjectEvent.time = 0.5;

animation[“Throw”].layer = 1; // Place the Throw animation on a higher level
animation[“Throw”].clip.AddEvent(throwObjectEvent); // Add the event to an AnimationClip

animation[“Throw”].blendMode = AnimationBlendMode.Additive; // set the blend mode to Additive so it will blend into whatever animation is playing when it’s called

animation.CrossFade(“Throw”,0.2); // Play the animation