Here you go sir:
var walkClip: AnimationClip;
var anim: Animation;
function Start() {
anim = GetComponent.();
anim.AddClip(walkClip, "walk");
}
I hope that helped. If you wanted to use C# here is the code:
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
public AnimationClip walkClip;
public Animation anim;
void Start() {
anim = GetComponent();
anim.AddClip(walkClip, "walk");
}
}
All of that is from the scripting API, so it should work. Just put incorporate that into the code you have right now and it should import the animation for use along side the script. =D
↧