DEV Community

KOGA Mitsuhiro
KOGA Mitsuhiro

Posted on • Originally published at qiita.com

UnityのAnimation Eventで関数定義と関数選択が分かりにくかった

はじめに

アニメーションイベントの使用 - Unity マニュアル[Unity] Animation Eventを使いこなそう!を参考に自作アニメーションにAnimation Eventをつけようとしたのですがインスペクターの挙動が分かりにくいのでまとめました。

Animation Eventの関数定義

  1. プロジェクトタブでAnimationファイルを選択します。
  2. アニメーションタブでAnimation Eventを選択します。
  3. インスペクターに関数定義が出てきます。

image.png

Animation Eventの関数選択

  1. ヒエラルキーで上記Animationを含むAnimation Controllerを関連付けたゲームオブジェクトを選択します。
  2. アニメーションタブでAnimation Eventを選択します。
  3. インスペクターに関数選択が出てきます。

image.png

まとめ

何でこんな挙動なのか考えてみると分かったのですが、関数定義はAnimation Eventの定義はAnimation自体にあるのでファイルを選択してから、関数選択は同じゲームオブジェクトにアタッチしたスクリプトから選ぶのでヒエラルキーのゲームオブジェクトを選択してからなので納得できます。とは言え直前に選択したもので挙動が変わるのは分かりづらい…

参考リンク

AWS Q Developer image

Your AI Code Assistant

Generate and update README files, create data-flow diagrams, and keep your project fully documented. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay