Sprite Factory

ReadMe
Release Notes
Overview
Using the Editor
Upgrading

Concepts
Sprites
Master Sprites
Sprite Groups
Colliders
Locators
Material Sets
SpriteUpdater
SpriteCamera

Advanced
Working in Multiple Projects

Classes
Runtime Classes

Videos
Overview
Creating Sprites
Sprite Inspector
Frame Events
Collision System
Locator System
Material Sets

Links
Sprite Factory Site
Web Documentation
Support
Contact

SpriteFactory.Sprite.SetAnimationFinishedCallback

C#: void SetAnimationFinishedCallback (string animationName, System.Action callback)
JS: function SetAnimationFinishedCallback (animationName : String, callback : System.Action) : void

Description
Assign a callback to run when an animation finishes playing. Use this to take some action after an animation finishes playing. This will never be called when animation wrapMode is set to Clamp, inifinite Loop, or infinite PingPong.

Example:

C#

void Start() {
    // Set up callbacks for when animations finish playing
    sprite.SetAnimationFinishedCallback("Jab", AttackAnimFinished);
    sprite.SetAnimationFinishedCallback("BodyBlow", AttackAnimFinished);
    sprite.SetAnimationFinishedCallback("Uppercut", AttackAnimFinished);
}

private void AttackAnimFinished() {
    // do something
    Debug.Log("Attack animation finished");
}
JS
function Start() : void {
    // Set up callbacks for when animations finish playing
    sprite.SetAnimationFinishedCallback("Jab", AttackAnimFinished);
    sprite.SetAnimationFinishedCallback("BodyBlow", AttackAnimFinished);
    sprite.SetAnimationFinishedCallback("Uppercut", AttackAnimFinished);
}

function AttackAnimFinished() : void {
    // do something
    Debug.Log("Attack animation finished");
}

C#: void SetAnimationFinishedCallback (int animationIndex, System.Action callback)
JS: function SetAnimationFinishedCallback (animationIndex : int, callback : System.Action) : void

Description
Assign a callback to run when an animation finishes playing. Use this to take some action after an animation finishes playing. This will never be called when animation wrapMode is set to Clamp, inifinite Loop, or infinite PingPong.

Example:

C#

void Start() {
    // Set up callbacks for when animations finish playing
    sprite.SetAnimationFinishedCallback(0, AttackAnimFinished);
    sprite.SetAnimationFinishedCallback(1, AttackAnimFinished);
    sprite.SetAnimationFinishedCallback(2, AttackAnimFinished);
}

private void AttackAnimFinished() {
    // do something
    Debug.Log("Attack animation finished");
}
JS
function Start() : void {
    // Set up callbacks for when animations finish playing
    sprite.SetAnimationFinishedCallback(0, AttackAnimFinished);
    sprite.SetAnimationFinishedCallback(1, AttackAnimFinished);
    sprite.SetAnimationFinishedCallback(2, AttackAnimFinished);
}

function AttackAnimFinished() : void {
    // do something
    Debug.Log("Attack animation finished");
}

See Also
SetAnimationStartedCallback
SetAnimationEndedCallback