Search Unity

I need help with Animator and JavaScript

Discussion in 'Animation' started by Costin89, Feb 14, 2015.

  1. Costin89

    Costin89

    Joined:
    Feb 14, 2015
    Posts:
    1
    this is my script …
    Code (JavaScript):
    1. var anim : Animator;
    2. var alter: GameObject;
    3.  
    4. function Start () {
    5.      anim = alter.GetComponent("Animator");
    6. }
    7.  
    8. function Update () {
    9.      if(Input.GetKeyDown("z"))
    10.     {
    11.         anim.SetTrigger("select");
    12.     }
    13.    
    14.     if(Input.GetKeyDown("b"))
    15.     {
    16.         anim.SetTrigger("norm");
    17.     }
    18. }
    but I do not understand the console

    Assets/select.js(7,35): BCW0028: WARNING: Implicit downcast from 'UnityEngine.Component' to 'UnityEngine.Animator'.