Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Some animation aren't working in build for no apparent reason (case : IN-31623)

Discussion in 'Entity Component System' started by WAYNGames, Feb 9, 2023.

  1. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    939
    Hello,

    I have setup a project with entities 1.0.0-pre.15 in Unity 2022.2.5f1. In a sub scene I have a baked entity that spawn a game object prefab at runtime. Outside of the sub scene I added the same prefab. In editor, booth game objects are animated.
    In Windows build, only the game object out of the sub scene is animated.
    The other one is spawned but it's animations are not all executed.
    I tried with both Mono and IL2CPP, with sub scene open/closed when building, sub scene included or excluded for the build settings. Same results.


    Hi, I tried using the character from the Starter Assets - Third Person Character Controller and none of the animations worked in the built project.

    I also tried to use the latest beta (2023.1.0b3) version of unity but still the same results.

    I did not find anything in the build log, nor in the player logs.

    Here is a video of the result.

    On the left is the editor.
    On the right is the windows built.

    in each window, you can see 2 set of character.
    The left one is the GameObject in the scene.
    The right on is the GameObject spawned by the entity.




    Since DOTS is to work alongside GameObject for feature not covered by DOTS such as Animation, it would be better if it worked in all cases.
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,626
    The video is private
     
  3. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    939
    Thanks I updated the visibility
     
  4. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    909
    Have you found anything on this issue? Getting it too now -.-
    No idea how this can even happen. It was working fine in my build 10 days ago.
     
  5. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    939
    The bug ticket is under review since March 8th. I kept trying with every new version of both editors and packages with no change in the behavior.

    I'm sorry for you but glad I'm not the only one having the issue. It reduces the probability of me unknowingly doing something wrong with my animations.

    If you can/want to post a bug report for unity to have one more reproduction case, you can mention my ticket in your and post back your ticket number here. I'll add a mention in my ticket saying other user have the same issue and asking if they managed to reproduce.
     
    Occuros likes this.
  6. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    909
    Went through all my commits. Broken for a long time with 1.0-exp8 being the last working version. Tested up to pre.65 and with various Unity versions. from 2022.2.b9 to the latest.

    I have 0 explanation how that worked when you asked in Discord. Must have been my luckiest day ever because it's pretty random which animation clip ends up being null.

    Tertle told me he was having similar issues with UIToolkit prefabs, some fields were just randomly null. But he also said that it's fixed since pre.45 which is not the case for us.

    edit: The bug seems like it's bigger than just animations. Could affect all referenced GO prefabs.
     
    Last edited: Mar 28, 2023
  7. desertGhost_

    desertGhost_

    Joined:
    Apr 12, 2018
    Posts:
    258
    I use Addressables to load in any game objects / scriptable objects to avoid these kinds of bugs. You can store the address as a hash128 in a struct component and load in the data in a system. e.g.
    Code (CSharp):
    1.     public struct AddressableKey
    2.     {
    3.         public Hash128 Value;
    4.         public bool IsValid;
    5.     }
    6.  
    7.     public sealed class LinkedGameObject : IDisposable
    8.     {
    9.         public AsyncOperationHandle<GameObject> Handle;
    10.         public AddressableKey Key;
    11.  
    12.         public static AsyncOperationHandle<GameObject> Instantiate(AddressableKey key, Vector3 position,
    13.             Quaternion rotation)
    14.         {
    15.             Key = key;
    16.             Handle = !key.IsValid
    17.                 ? default
    18.                 : UnityEngine.AddressableAssets.Addressables.InstantiateAsync(key.Value.ToString(), position, rotation);
    19.  
    20.             return Handle;
    21.         }
    22.  
    23.         public void Dispose()
    24.         {
    25.             if (Handle.IsValid() && !UnityEngine.AddressableAssets.Addressables.ReleaseInstance(Handle) &&
    26.                 Handle.Result != null)
    27.             {
    28.                 Object.Destroy(Handle.Result);
    29.             }
    30.         }
    31.     }
     
    Last edited: Mar 28, 2023
    Enzi likes this.
  8. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    284
    I had the same issue, and I'm not certain that it will help in this use case, but after I added the~~ AnimationRigging Package from Unity, all animations stopped working (even hybrid ones).

    After removing that package all is working again, and I'm using now FinalIK to handle my IK needs.

    Maybe this can help someone who has broken animations in the current ecs package.


    AnimationRigging Package seems to be incompatible with ecs, but removing it still didn't solve all our animations.

    It seems its really random which ones will work and which ones won't in a build.
     
    Last edited: Apr 14, 2023
  9. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    284
    We added our use case: IN-38365 to the bug list, referencing this thread.
     
  10. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    284
    Can confirm, using the same prefabs, spawning them with the addressable system works as expected, spawning them through a prefab reference has some of them broken.

    Also, be careful not to directly use `AssetReference` inside a component otherwise the typehash won't be created properly and you get a `TypeIndex` exception.

    Thank you @desertGhost_ for sharing your insight!
     
    Anthiese likes this.