- Home /
Question by
katho3d · Sep 05, 2013 at 08:10 AM ·
animation script
Animation of a specific GameObject doesn´t play
It´s a very simple script (on box1), which should play an animation of another object (box2). There is no error message, the animation simply doesn´t play.
Here is the script:
var box : GameObject;
var box01 : AnimationClip;
function Update () {
if(Input.GetKeyDown("d")){
animdirection();
}
if(Input.GetKeyDown("p")){
box.animation.Play("box01");
// animplay();
}
}
Thanks in advance!
Comment
Answer by Shkarface-Noori · Sep 05, 2013 at 09:04 AM
var box : GameObject;
var box01 : GameObject;
function Update () {
if(Input.GetKeyDown("d")){
animdirection();
}
if(Input.GetKeyDown("p")){
box.animation.Play(box01);
// animplay();
}
}
remember the string :D
Thanks, but this doesn´t work either. :-( "box01" was the animation name of the box object. I´ve renamed some of the objects to make it clearer. The script is on the main camera and it should start the animation named "animation01" of the box object.
var box : GameObject;
function Update () {
if(Input.Get$$anonymous$$eyDown("p")){
box.animation.Play("animation01");
}
}
Your answer
Follow this Question
Related Questions
creating new animations with mecanim 0 Answers
Sword Animation 1 Answer
How to loop unity?JS 3 Answers
How does vector multiplication and position updates work in unity? 1 Answer
Error Rotation Object when add animation 0 Answers