c# - Why i'm getting error the animation clip name Up not found? -


i have gameobject empty renamed called: elevator. under childs have platform, platform1, , button.

what want when player thirdpersoncontroller standing on platform , click button elevator move , down none stop.

in screenshot hierarchy , script called lift , animations: elevator , , down. first selected elevator in menu did window > animation created animation called elevator didn't anything. created more 2 animations called them: , down. when play empty gameobject move childes. when play down it's moving down.

the script lift attached button. added component animation gameobject(elevator).

this screenshot:

screenshot

this c# script:

using unityengine; using system.collections;  public class lift : monobehaviour {      private bool pressedbutton = false;     private bool iselevatorup = false;      gameobject target;      void onmouseover()     {         pressedbutton = true;     }      void onmouseexit()     {         pressedbutton = false;     }      void onmousedown()     {         if(iselevatorup == false)         {             target = gameobject.find("elevator");             target.getcomponent<animation>().play("up");             iselevatorup = true;         }         else         {             target = gameobject.find("elevator");             target.getcomponent<animation>().play("down");             iselevatorup = false;         }     }      void ongui()     {         if(pressedbutton == true)         {             gui.box(new rect(300, 300, 200, 20), "press use lift!");         }     } } 

in elevator inspector dragged animation animation clip.

when running game i'm getting 2 messages:

  1. with sign '!' default clip not found in attached animation list.

  2. a warning: abimationclip 'up' used animation component "elevator" must marked legacy.

when move mouse on button see small box: "press use lift!" when click button see error message:

the animation state not played because couldn't found! please attach animation clip name 'up' or call function existing animations.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -