Quantcast
Channel: Answers for "there is no 'animation' attached to the gameobject but a script is trying to access it"
Viewing all articles
Browse latest Browse all 6

Answer by HD32

$
0
0
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

Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles





Latest Images