Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

Animation.AddClip

マニュアルに切り替える
public void AddClip(AnimationClip clip, string newName);

パラメーター

説明

newName として clip をアニメーションとして追加します。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public AnimationClip walkClip; public Animation anim; void Start() { anim = GetComponent<Animation>(); anim.AddClip(walkClip, "walk"); } }

public void AddClip(AnimationClip clip, string newName, int firstFrame, int lastFrame, bool addLoopFrame = false);
public void AddClip(AnimationClip clip, string newName, int firstFrame, int lastFrame, bool addLoopFrame = false);

パラメーター

addLoopFrame Should an extra frame be inserted at the end that matches the first frame? Turn this on if you are making a looping animation.

説明

clipfirstFrame から lastFrame までの再生のみを追加します。新しいクリップは newName の名前でアニメーションに追加されます。

もしすでに存在する名のクリップの場合、新しいクリップに入れ替わります。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Animation anim; void Start() { anim = GetComponent<Animation>(); anim.AddClip(anim.clip, "shoot", 0, 10); anim.AddClip(anim.clip, "walk", 11, 20, true); anim.AddClip(anim.clip, "idle", 21, 30, true); } }