LoginSignup
16
17

More than 5 years have passed since last update.

2Dアニメーションのメソッド呼び出しが凄く便利

Last updated at Posted at 2013-12-17

4.3から追加された2Dのアニメーションエディタではアニメーションの好きなタイミングでアタッチしてるスクリプトのメソッド呼べるので超絶便利です。
Edit Animation Event

ただ、これはメソッドしか呼べないのでデリゲートとか使って汎用的に使おうとした場合、下記のような感じのスクリプトをアタッチしておくと楽そうです。

public class AnimationObserver : MonoBehaviour {
    public Action animationEndNotify;

    public void Notify()
    {
        if(animationEndNotify != null)animationEndNotify();
    }
}

実際のロジックを書いてるクラスから animationEndNotify を設定するイメージ。
通知するだけなので新規にイベントハンドラ定義しなくてもActionで済みそう。

16
17
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
17