Search Unity

Bug i cant select the animation in the inspector

Discussion in 'Scripting' started by MAZpen_, May 22, 2023.

  1. MAZpen_

    MAZpen_

    Joined:
    May 22, 2023
    Posts:
    1
    i have a simple code:

    public Animation chest;
    {...}
    if (collision.gameObject.name == "chest")
    {
    chest.Play();
    }...

    and when i go into the inspector to select my animation (chestOpen) i cant select it. i cant select any type of animation. Is their an issu with my code or is my unity just broken??

    thanks you in advance for your time!
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    Make sure you did not make an
    Animator
    if you're expecting an
    Animation
    ...it's confusing.

    An
    Animation
    is a legacy component. You don't use that with
    Animators
    .

    And the actual THING, the data that makes things animate ... well that is an
    AnimationClip


    There's a spatula over by the front door to help scrape brains off the ceiling.