Search Unity

Play animations from other programs?

Discussion in 'Animation' started by Denisowator, Jul 29, 2015.

  1. Denisowator

    Denisowator

    Joined:
    Apr 22, 2014
    Posts:
    918
    I made an animation in Blender, and I don't know how to make it play in Unity.

    Thanks in advance. :)
     
  2. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,513
    First, is the .blend or FBX file in the Assets folder.
     
  3. Denisowator

    Denisowator

    Joined:
    Apr 22, 2014
    Posts:
    918
    At first I had them both, but I saw that the .blend file had the camera following the animated object so I moved it (The FBX file is in the assets folder).
     
  4. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,513
    When you drag the FBX asset into the Hierarchy, it must have an Animator component on it, and then, the Animator component must have a animation Controller assigned in the Motion slot. The controller is another asset in your Project folder. Create one, and then add a new state by dragging the animation clip in the FBX into the Animation window.
     
  5. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,552
    Denis, please don't forget you have an outstanding invoice to pay.
     
    theANMATOR2b likes this.
  6. Denisowator

    Denisowator

    Joined:
    Apr 22, 2014
    Posts:
    918
    OK, I did everything you said. Do I have to do anything else, or can I now activate the animation using scripts?
     
  7. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,513
    That should work. What does it do?
     
  8. Denisowator

    Denisowator

    Joined:
    Apr 22, 2014
    Posts:
    918
    It's a spawning animation that makes the character grow from nothing as it floats up and rotates, before floating back down and giving control to the player.
     
  9. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,513
    I should have phrased that better. When you press play, what happens?

    Also, is that animation related to @AaronC? You should probably pay his invoice.
     
    theANMATOR2b likes this.
  10. Denisowator

    Denisowator

    Joined:
    Apr 22, 2014
    Posts:
    918
    The animation I'm talking about is my own version of what I've asked AaronC for, since I couldn't get his animation to work as I wanted it to.

    Also when I press play, the animation works fine. Would I use scripts to make it play only at a certain point? Since whenever I hit play it activates and that's it, it just stands there.
     
    Last edited: Jul 31, 2015
  11. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,513
    Yeah. So, in order to control it from script, you'd probably need to add another state for idle/inactive, and then assign the appropriate transition lines. Then, when you click on the transition line, you will see that you can add a parameter. You'd add a trigger param, and in script, you'd call Animator.SetTrigger() to switch states.
     
  12. Denisowator

    Denisowator

    Joined:
    Apr 22, 2014
    Posts:
    918
    Thank you. :)
     
  13. Denisowator

    Denisowator

    Joined:
    Apr 22, 2014
    Posts:
    918
    I've never used the animator before, could you possibly show me what it should look like?
     
    Last edited: Jul 31, 2015
  14. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,513
    Watch this whole video:
    https://unity3d.com/learn/tutorials/projects/2d-roguelike/player-animator?playlist=17150

    Moving forward, doing google searches and reading around, you can probably get some good results for most of your questions. It's the most valuable skill a game developer must acquire to finish a project.

    You got a pass for this one, because the Unity documentation actually doesn't tell you how to add transitions, only states. Shame on them.
     
    theANMATOR2b likes this.
  15. Denisowator

    Denisowator

    Joined:
    Apr 22, 2014
    Posts:
    918
    Thank you. :D
     
  16. Denisowator

    Denisowator

    Joined:
    Apr 22, 2014
    Posts:
    918
    Thank you for the advice. :D
     
  17. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,552
    The solution provided was the solution requested - and was done on the cheap as a favor, and was modified even after delivery for you because you changed your requirements. If you request a solution and that solution is delivered, you pay. Its called business.

    If you're going to be a dodgy client around here - expect to be treated like one.
     
  18. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,552
    Invoice unpaid and cancelled..

    A warning to others..

    Denis Pawszok /dawit444@wp.pl