Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Animation blending with a script

Discussion in 'Animation' started by Fatzer, Oct 2, 2015.

  1. Fatzer

    Fatzer

    Joined:
    Oct 2, 2015
    Posts:
    7
    hello together

    I have a little problem with the script I have from the documentation site from unity. in the screenshot you can see that there are 2 mistakes in the script and I have no idea what's wrong. So you have to know that i can't program and I'd be very happy if someone could help me.

    thank you very much ;) Screenrutschen.png
     
  2. McMayhem

    McMayhem

    Joined:
    Aug 24, 2011
    Posts:
    443
    The mistake is trying to access the animation component directly. You aren't able to use that method to access a GameObjecct's animation component anymore.

    Instead you will want to use this method:
    Code (CSharp):
    1. GetComponent<Animation>().CrossFade("anim");
    Hope that helps.
     
  3. Fatzer

    Fatzer

    Joined:
    Oct 2, 2015
    Posts:
    7
    Thank you very much :)