Question by
Bohdan-Shpytko · Aug 25, 2015 at 09:36 AM ·
c#animationunity 5scene
I cant addet animation to script
I make script. To correct need to work properly Animation, but I can't aded it to myscript. when press add I cant choose animation on this scene
when I chose Assets, I finaly can choose my animation, but it doesen't work because animation doesent added
dooranim = dooranim.GetComponent<Animation>();
I Use this code to added animation to script.
Comment
Answer by Positive7 · Aug 25, 2015 at 11:21 AM
AnimationClip is what you're looking for I belive :
public AnimationClip dooranim;
void Start () {
dooranim = GetComponent<AnimationClip>();
}
or If you have Animation Component attached :
using UnityEngine;
public class test : MonoBehaviour {
public Animation doorAnim;
public AnimationClip doorAnimClip;
void Start () {
doorAnim = GetComponent<Animation>();
doorAnim.clip = doorAnimClip;
}
}
Your answer
Follow this Question
Related Questions
Crossfadeanimations dont play 0 Answers
Fade In Fade Out in Carboard 0 Answers
Door animation bugs and stays open unity 3D 0 Answers
UNET Multiple online scenes 0 Answers
How to get the angle to animate the player when running? 0 Answers