Search Unity

How can i change Player's animation on weapon pickup?

Discussion in '2D' started by unity_7mUigJCPWkPLKg, Jan 8, 2019.

  1. unity_7mUigJCPWkPLKg

    unity_7mUigJCPWkPLKg

    Joined:
    Jan 8, 2019
    Posts:
    1
    Hello! I'm a complete beginner in programming and i'm actually not doing that bad on my first ever game.. besides getting stuck on problems like this of course. Basically i got my Player's run and idle animation with him holding a Pistol up. I want to make it so if he collides with a Shotgun Sprite, his animation (run and idle) go from the Pistol run and idle to a complete different animation of him (running or idling) with a Shotgun. Sounds a bit complicated but i hope you guys can help me.
    (In other words, change him from having a Pistol to having a shotgun, which needs a change of the whole animations).
    Thank you in advance!
     
  2. beanie4now

    beanie4now

    Joined:
    Apr 22, 2018
    Posts:
    311
  3. hlw

    hlw

    Joined:
    Aug 12, 2017
    Posts:
    250
    Make some transitions between gun and shotgun animations, and new bools in the animator. Make those transition to check if the bool is true. When you pick up the shotgun, change the bools of the animator, and the transition will happen.
     
    tung546012 likes this.
  4. ManiaCCC

    ManiaCCC

    Joined:
    Aug 15, 2015
    Posts:
    41
    Or you could make just override layer in your animator, where state will be changed based on weapon you are using. There are many ways how to approach this.