Unity でゲームオブジェクトをアニメーションさせる場合、オブジェクト単体、オブジェクトのグループに Animator コンポーネント をアタッチする必要があります。この Animator コンポーネントは Animator Controller を参照する必要があります。また、Animator Controller は、1つ以上の アニメーションクリップ への参照を含んでいます。
Unity で、ゲームオブジェクトをアニメーションさせるために Animation ビューを使うと、これらの項目すべては自動的に作成され、アタッチされ、設定されます。
選択されたゲームオブジェクトの新しい アニメーションクリップ を作成するには、Animation ウィンドウ が表示されていることを確認してください。
ゲームオブジェクトにアニメーションクリップがまだ、割り当てられていない場合は、Animation ウィンドウのタイムラインの中央に “Create” が表示されます。それをクリックすると、新しい空のアニメーションクリップを Assets フォルダーの任意の場所に保存するように指示されます。
この新しい空のアニメーションクリップを保存すると、多くのことが自動的に追加されます。
この自動処理の結果、アニメーションシステムで必要なすべての要素が設定され、そのオブジェクトをアニメーションさせることができます。
ゲームオブジェクトに 1 つ以上のアニメーションクリップがすでに割り当てられている場合、“Create” ボタンは非表示です。代わりに、クリップの 1 つが Animation ウィンドウに表示されます。表示するアニメーションクリップをウィンドウ左上のメニュー (再生ボタンのすぐ下) で変えることができます。
すでにアニメーションクリップがあるオブジェクトに新しいクリップを作成したい場合は、このメニューから “Create New Clip” を選択します。それを使用する前に、再び、新しい空のアニメーションクリップを保存するように指示されます。
前述のステップで自動的に関連コンポーネントと参照を設定できますが、どの部分がともに接続されるべきかを理解すると役立ちます。
下の図は Animation ウィンドウで新しいアニメーションクリップを作成してから、どのようにさまざまな部分が割り当てられていくかを示した図です。
以下の画像で、選択中のゲームオブジェクト (“Cube”) はまだ、アニメーション化されていません。Animator コンポーネントのない、ただの Cube があるだけです。Animation, Hierarchy, Project, Inspector ウィンドウは、見やすいように横ならびにアレンジされています。
Animation ビュー (左側) にある Create ボタンを押すと、新規のアニメーションクリップが作成されます。Unity は、この新しいアニメーションクリップを保存するときに、名前と保存する場所を尋ねます。また、Unity は、選択したゲームオブジェクトと同じ名前で Animator Controller のアセットを作成し、Animator コンポーネントをゲームオブジェクトに追加して、アセット同士を適切に接続します。
上記の新しいビューでは以下が確認できます。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.