Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

Animations not working. Even standard asset (construction worker) animations

Discussion in 'Animation' started by softwizz, Sep 14, 2013.

  1. softwizz

    softwizz

    Joined:
    Mar 12, 2011
    Posts:
    793
    Hello.

    Unity V 4.2.1.f4
    Blender 2.68

    When I import a model from Blender either as .blend or .fbx I cannot get animations to play.

    YES I am setting Rig ->Animation Type -> Legacy

    YES I am setting Generation -> Store in Root (new)

    In the little preview window in the inspector the animations will play.

    If I put the model in a scene and open the animation window the animations will play.

    If I run the scene the animations dont play.

    I have tried 'Play Automatically', didnt work

    I have tried playing an animation with a script, not working ( although it did look like it played the first frame)

    I imported the standard asset of the construction worker and all the above applies to that model and animations too.


    I tried all the above in Unity 3.5 AND Unity 4.0 and animations work perfect. So it cant be a problem with the models as even the supplied standard asset construction worker acts the same.

    This problem means I cannot continue a project I just started as my characters wont animate.

    Any ideas on whats wrong?

    Thanks.
     
    Last edited: Sep 15, 2013
  2. softwizz

    softwizz

    Joined:
    Mar 12, 2011
    Posts:
    793
    So this is the script I am using just to test with:
    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.      
    4. public class PlayAnimation : MonoBehaviour
    5. {
    6.     void Update()
    7.     {
    8.         if (Input.GetButtonUp("Fire1"))
    9.             {
    10.                 animation.Play("walk");
    11.             }
    12.     }
    13. }
    And when I press 'Fire' it plays the first frame only then stops. I added the following to the script after 'animation.Play("walk")'
    Time.timeScale = 1.0f;

    Now the animation plays all the way through.

    BUT why does only the first frame play without this line?

    If I put the model in the scene without any script and check the box for 'Play Automatically' it will still only play the first frame.

    Is there some setting in the build options or some other place that needs changing.
     
  3. softwizz

    softwizz

    Joined:
    Mar 12, 2011
    Posts:
    793
    HA!
    I solved it:

    Edit -> Project Settings -> Time: Time Scale was set to 0 so I changed it to 1 (Realtime)

    Now amimations play as they should even without a script. :p
     
    Last edited: Sep 15, 2013
  4. hedongjun

    hedongjun

    Joined:
    Sep 15, 2013
    Posts:
    3
    Nice !I study a lot.
     
unityunity