Search Unity

Animator bug in Build version and not in the editor - Project sample included

Discussion in 'Animation' started by mribaud, Aug 6, 2014.

  1. mribaud

    mribaud

    Joined:
    Jul 15, 2014
    Posts:
    12
    Hi,

    my problem is the following: I have a prefab with an animator controller attached to it.

    In the editor, when the prefab is instantiated, it plays its default idle animation with no problem.
    With the build, no animation is being played, and I absolutely don't know why.

    I prepared a very simple project in order to share it:

    - I created a prefab (called GameObject) with two child spheres in it. It has two animations, shot and idle (spheres moving left/right in idle, up/down in shot). To switch to shot, a trigger "shot" must be raised.

    - I created a script (Instantiate sphere) which instantiate this prefab, and trigger "shot" after 3 seconds.

    1. Play the scene in Unity editor: everything's alright.
    2. Build the game after that: everything's alright too.
    3. Close Unity, Open Unity, Build the game without running the scene before: no animation is being played on the prefab.

    Attached, a zip with the project files. Just unzip and open in unity.

    Note: I've reproduced it on different computers.
    Note 2: Unity Pro, 4.5.2f1 (latest)

    Thanks in advance, and please let me know if I'm doing something wrong!
     

    Attached Files:

  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,438
    seems to work on my pc, followed those steps.. (unity 4.5.0, build: win x86)
     
  3. mribaud

    mribaud

    Joined:
    Jul 15, 2014
    Posts:
    12
    Ok, thanks for trying, strange.
    (the important thing in the repro is to be sure you build after a fresh unity boot but as you said you followed the steps, I guess you did that)

    Going to try on another computer too.
     
  4. mribaud

    mribaud

    Joined:
    Jul 15, 2014
    Posts:
    12
    Just wanted to confirm that I've reproduced it on another computer.

    When you run the game, you should see two spheres not moving at all.

    P.S. : don't forget to open the scene and include it in the build, we forgot to do that at the beginning
     
  5. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    Hi mribaud,

    This is a know issue which has been fixed in 5.0, as a workaround simply put the prefab object in the loaded scene just before building your game, that should trigger a refresh of the controller.

    If it doesn't work, log a bug with your scene and PM me the bug #, I will take a look

    Best regards,
    Sonny
     
  6. mribaud

    mribaud

    Joined:
    Jul 15, 2014
    Posts:
    12
    Hi Sonny,

    thanks for your answer.

    Is it going to be merged to 4?
    I knew this workaround but it's annoying to do such a thing before any build, especially in a team of several people.
    Hope it will!

    Regards,

    mic