Problem with Animator when building for webplayer

Hi,
I have a very random bug (I submitted an issue but no response from unity) which happen when i create a build for unity webplayer (i have a pro version and i use unity 4.5.2f1).
Sometimes the animators looks like they are not loaded (my avatar stay in default position).

This happen when i create the build (and not when i launch it), because when you notice that the bug happen, it always do. This is very annoying because i have four different animator in my game (i switch to one on another), and one of them is sometimes subject to the problem, but not always the same!
I also use the unify script HeadLookController (which able to rotate a character head), but i don’t think this is part of the current problem.
Thanks for your help :slight_smile:

Please PM me your bug number.

Have you solved the problem?
I seem to have a similar issue with the Animator and the Webplayer.
I tried to load the Stealth demo from Unity and on some machine the Animator is not executing the shoot animation on others it does.

Hi

Have you solved the problem?
I have a similiar problem, i have an animator for a charater with several animations, this works good on Windows, Mac, iOS and Android, but when i export to web same animations aren’t playing.

Thanks.

No not really. What I did was change to Unity v4.3 which seems to work for me at least for PC.
Now my animations run correctly on a PC in the web player, Mac is still not working properly.

Well 3 months later, after rebuilding the bundles for my game, the problem is back again! I’m using Unity 4.5.4f1 and the problem only appears on web player (no problem on IOS and Android versions)…

Animator.layerCount = 0 in that case…

Hi guys,

So it seem like a bug we did fix for 5.0, the controller is never build by the build process. As a workaround copy paste this script inside a Editor Folder to get the option from the menu. Before you build your game make sure you click on Mecanim/Build controllers.

using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;

public class MecanimUtility
{
    [MenuItem("Mecanim/Build Controllers")]
    public static void DoBuildControllers()
    {
        UnityEditorInternal.AnimatorController[] controllers = UnityEngine.Object.FindObjectsOfTypeAll(typeof(UnityEditorInternal.AnimatorController)) as UnityEditorInternal.AnimatorController[];
        Debug.Log("Building controller list ...");
        foreach (UnityEditorInternal.AnimatorController controller in controllers)
        {
            Debug.Log("Building " + controller.name);

            string name = controller.name;

            // By changing a serialized property we are forcing the asset to rebuild itseft.
            SerializedObject obj = new SerializedObject(controller);
            SerializedProperty nameProp = obj.FindProperty("m_Name");
            nameProp.stringValue = "temp";
            obj.ApplyModifiedProperties();

            nameProp.stringValue = name;
            obj.ApplyModifiedProperties();
        }
    }
}

Let me know if it fix your issue

1 Like

Ihave the same problem with animattios during buildtime for the web.
running the above script gives me:
Assets/MecanimUtility.cs(2,7): error CS0246: The type or namespace name `UnityEditor’ could not be found. Are you missing a using directive or an assembly reference?

unity v 4.6.0b17

thx, /martin.

Works for me, thank you!

@DINmatin_1 , you need to put the script in an Editor folder, otherwise Unity will think that this script is part of your final game and UnityEditor namespace is not available in the player(standalone)

thank you for caring mecanim.dev. i placed it in “C:\Program Files (x86)\Unity\Editor”, my fault.

for the others: create a folder in the projectfolder on the same level as Assets.
works fine now. thx!

I have a similar problem. One of my animators does not play an animations.
Unfortunately, the script did not help.

Is “Animator.layerCount = 0” an indicator of the problem?
Possibly I have other problem, if layerCount = 1 for me.

Thanks.

yes, “Animator.layerCount = 0” is an indicator of the problem.

In your case it probably something else.
Please log a bug with your project so we can repro
Thanx

No meu unity 5 fica aparecendo esse erro :

Erro CS0246: O tipo ou nome de espaço de nomes `animador 'não foi encontrado. Você está faltando uma referência de montagem?

o que devo fazer ?

usando System.Collections;
using System.Collections.Generic;
usando UnityEngine;

classe pĂşblica PerssonagemWalk: MonoBehaviour {

animador privado _animator;
flutuador privado _run = 0;

void Start () {
animador = GetConponet ();

}

void Update () {
_Run = input.GetAxis (“vertical”);
Debug.Log (_Run);
}

}