Animationコンポーネントはアニメーションを再生するために使用されます。
スクリプトから、アニメーションのコンポーネントと再生に必要な、AnimationClipクラスにアクセスすることができます。
Unityのアニメーションシステムはウェイトを基準としてサポートしています:
アニメーションを組み合わせたり/加えたり/混ぜたり、レイヤーとアニメーション再生の全ての面について完全にコントロールします。
アニメーションのスクリプトの概要に関しては こちら を御覧ください。
簡単な再生はAnimation.Playを使用します
アニメーション間のクロスフェードはAnimation.CrossFadeを使用します
アニメーションのラップ(Loop, Once, PingPong)の変更するにはアニメーションのインポート設定でそれぞれのAnimationClipの WrapMode を変更するかランタイムではAnimationState.wrapModeを使用して変更します。
AnimationState はアニメーションのレイヤーうぃ変更して使うことが出来、再生スピードを変更し、アニメーションのブレンドやミックスを直接操作することが出来ます。
AnimationはEnumeratorをサポートしているのでこのように全てのAnimationStateをループで取得することが出来ます:
// Make all animations in this character play at half speed for (var state : AnimationState in animation) { state.speed = 0.5; }
See Also: Unityのアニメーションスクリプトの概要は こちら を御覧ください
animatePhysics | 有効にするとアニメーションはPhysicsループ内で実行されるようになります。これはKinematicのRigidbodyと一緒に使用した場合に有効になります。 |
clip | デフォルトのアニメーション |
cullingType | Animationコンポーネントのカリング制御 |
isPlaying | アニメーションが再生されているかどうか |
localBounds | ローカル座標におけるアニメーションコンポーネントのアニメーションのバウンズ |
playAutomatically | スタートアップの時にデフォルトのアニメーションクリップ(Animation.clip)が自動的に再生する場合はtrueを設定します。 |
this[string] | アニメーションの名前を設定してステータスを返す。 |
wrapMode | 再生済みのクリップをどう扱うか |
AddClip | clip として clip をアニメーションとして追加します。 |
Blend | targetWeight 秒かけて targetWeight で animation という名のアニメーションをブレンドします。 |
CrossFade | animation 秒に渡り他のアニメーションをフェードアウトさせながら animation という名のアニメーションをフェードインさせます。 |
CrossFadeQueued | 前回のアニメーションが終了した際に、アニメーションをクロスフェードします。 |
GetClipCount | このアニメーションに割り当てられているクリップの数を取得します。 |
IsPlaying | /name/ という名のアニメーションが再生中かどうかを確認します。 |
Play | アニメーションをブレンドせずに再生します。 |
PlayQueued | 前回のアニメーションが終了した後に、アニメーションを再生します。 |
RemoveClip | アニメーションリストからアニメーションを削除します。 |
Rewind | /name/ という名のアニメーションを巻き戻します。 |
Sample | 現在のステートでサンプリングを行います。 |
Stop | Animationクラスから再生した全てのアニメーションの再生を停止します。 |
enabled | 有効であれば更新され、無効であれば更新されません。 |
isActiveAndEnabled | Has the Behaviour had enabled called. |
animation | GameObjectにアタッチされたAnimation (アタッチされていない場合はnull) |
audio | GameObjectにアタッチされたAudioSource (アタッチされていない場合はnull) |
camera | GameObjectにアタッチされたCamera (アタッチされていない場合はnull) |
collider | GameObjectにアタッチされたCollider (アタッチされていない場合はnull) |
collider2D | GameObjectにアタッチされたCollider2D |
constantForce | GameObjectにアタッチされたConstantForce (アタッチされていない場合はnull) |
gameObject | このコンポーネントはゲームオブジェクトにアタッチされます。コンポーネントはいつもゲームオブジェクトにアタッチされています。 |
guiText | GameObjectにアタッチされたGUIText (アタッチされていない場合はnull) |
guiTexture | GameObjectにアタッチされたGUITexture (アタッチされていない場合はnull) |
hingeJoint | GameObjectにアタッチされたHingeJoint (アタッチされていない場合はnull) |
light | GameObjectにアタッチされたLight (アタッチされていない場合はnull) |
networkView | GameObjectにアタッチされたNetworkView (アタッチされていない場合はnull) |
particleEmitter | GameObjectにアタッチされたParticleEmitter (アタッチされていない場合はnull) |
particleSystem | GameObjectにアタッチされたParticleSystem (アタッチされていない場合はnull) |
renderer | GameObjectにアタッチされたRenderer (アタッチされていない場合はnull) |
rigidbody | GameObjectにアタッチされたRigidbody (アタッチされていない場合はnull) |
rigidbody2D | GameObjectにアタッチされたRigidbody2D |
tag | ゲームオブジェクトのタグ |
transform | GameObjectにアタッチされたTransform (アタッチされていない場合はnull) |
hideFlags | オブジェクトは非表示、シーンに保存、ユーザーが編集可能などを行うかどうか |
name | オブジェクト名 |
BroadcastMessage | ゲームオブジェクトまたは子オブジェクトにある すべての MonoBehaviour を継承したクラスにある methodName 名のメソッドを呼び出します。 |
CompareTag | Is this game object tagged with /tag/? |
GetComponent | Returns the component of Type type if the game object has one attached, null if it doesn't. |
GetComponentInChildren | Returns the component of Type type in the GameObject or any of its children using depth first search. |
GetComponentInParent | Returns the component of Type type in the GameObject or any of its parents. |
GetComponents | Returns all components of Type type in the GameObject. |
GetComponentsInChildren | Returns all components of Type type in the GameObject or any of its children. |
GetComponentsInParent | Returns all components of Type type in the GameObject or any of its parents. |
SendMessage | Calls the method named methodName on every MonoBehaviour in this game object. |
SendMessageUpwards | Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour. |
GetInstanceID | Returns the instance id of the object. |
ToString | ゲームオブジェクトの名前を返します |
Destroy | ゲームオブジェクト、コンポーネントやアセットを削除します |
DestroyImmediate | 直ちにオブジェクトを破壊する。ですが、Destroy関数の方を使うことを推奨します |
DontDestroyOnLoad | 新しいシーンを読み込んでもオブジェクトが自動で破壊されないように設定します |
FindObjectOfType | タイプから最初に見つけたアクティブのオブジェクトを返します |
FindObjectsOfType | タイプから見つけた全てのアクティブのオブジェクト配列を返します |
Instantiate | original のオブジェクトをクローンします |
bool | オブジェクトが存在するかどうか |
operator != | 二つのオブジェクトが異なるオブジェクトを参照しているか比較します |
operator == | 二つのオブジェクトが同じオブジェクトを参照しているか比較します |