Animation doesn't play (170925)

I made a animation and it doesn’t play.
Can someone explain me what is happening? Do i need to show anything?
If yes, please let me know.

9 Answers

9

Well this could be anything and the lack of information doesn’t help. However, I will do my best to give you some tips of things to look at.

Tip 1:
Make sure your custom animation is the correct type. If using in a mecanim “Animator” component you can’t use “Legacy” animations with it. If you are using “Legacy” animations then you need to use an “Animation” component.

Tip 2:
If your animation is short and doesn’t loop it may be playing but will only play once. So it could be playing then stop so fast that you don’t notice it.

Tip 3:
Make sure your animation is applied to the correct component!

Tip 4:
If you are using a humanoid character make sure that you use a humanoid animation. Sometimes “Generic” animations work but make sure these things match up.

Tip 5:
If making your own animation you need to make sure that what character you make it on is the character that you are going to play it on. I have never had success making animations on one character and playing them on another (this is unless you make it with a program outside of Unity).

Hope these tips help you.

Another thing to check: is the object you are trying to animate marked as static? In the animation preview the animation will play, but it won’t in the game preview (when you press the “Play”-button) or when you actually compile and run.

If you are using the “Animation” component make sure you feed the animation clip to both the “Animation” and “Animations” fields.
Your animation clip should also be marked as “Legacy” you can do it by switching to debug mode in the inspector (press the three dots icon beside the lock icon and select debug) then select the animation clip and change the type to legacy.
Please note that legacy animation clips will not be played in the “Animator” component.

Possibly, I'm not experienced enough with internet data transferring to give definitive advice.

–

@wesleywh: thank you so much, Tip 1 saved my day! After trying about ten different suggestions on how to fix my animation problem, just replacing ‘Animator’ with ‘Animation’ Component did the trick for me.

WWW is for retrieving online data. If you want to access data stored on a computer from another computer, you are opening up a huge can of worms. Think about the security issues involved alone. It's probably better to upload the data instead to share it between games.

–

If I understand correctly, you have created an animation, and now you need to play it? if so, you need to run your animation in the animator (Window->animator). You use this to play an animation, loop it, run it based on parameters in a script, and so on.

Here is a link on how to use the Animator:

Attach an script to the GameObject with the animation, something like this:

using UnityEngine;
using System.Collections;
  
public class playAnimationScript : MonoBehaviour
{
    Animation yourAnimation;
  
    void Awake()
    {
        yourAnimation = yourGameObject.GetComponent<Animation>();
    }
  
    // This is an example only  
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            yourAnimation.Play("yourAnimationName");
        }
    }
}

@FabriBertani I forgot this! Thank you =]

–

Oh shoot, I had my monitor brightness turned down and only saw a black scene. Thought it made sense. In this case, I'm not quite sure. Let me test it myself.

–

i had the same issue, just changed the Update Mode to Unscaled Time and its working perfectly.

I do not wish to access the saved data from different computer. I want user A to save data from WebGL game G1 and load the same data in WebGL game G2. No server or other computer would be aware of that.

–

Go to ANIMATOR component → right click → click on OPTIMIZE TRANSFORM HIERARCHY.
I don’t know how it works but it works!

I see. Sorry, I misunderstood your issue then. However, I think the problem remains the same: Your game needs to save a file onto your computer; it doesn't matter if you save it from the other save of the world or from your own computer, there still needs to be an access tunnel, so to speak, from the internet to your local hard drive.

–

Wouldn't that access tunnel be the downloading of the game? I mean, after the client downloads the game, it runs everything locally unless if it makes an external request, right? So wouldn't the flow of the permissions be Application->Browser directly?

–

You could save a local file and open that in webgl from each game connected to your computer. But like previously said it's like opening a huge can of worms

–

I don't know a way to have permission from the browser to save a local file but can't I do something similar to what a cookie does?

–

http://answers.unity3d.com/questions/1095407/saving-webgl.html

–

my animation does not work it works perfectly fine in the “animation” but in the game it does not work