Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved How to bulid a scene used dots animation?

Discussion in 'DOTS Animation' started by Sunstrace, Mar 13, 2021.

  1. Sunstrace

    Sunstrace

    Joined:
    Dec 15, 2019
    Posts:
    40
    I try to build a scene used clipplayernode.but failed and has an error:

    error CS1061: 'BlobAssetStore' does not contain a definition for 'GetClip' and no accessible extension method 'GetClip' accepting a first argument of type 'BlobAssetStore' could be found (are you missing a using directive or an assembly reference?)

    so how do i to fix this?
     
  2. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    851
    right now conversion relies on something that is editor only, so you need to put all animation into subscenes
     
  3. Sunstrace

    Sunstrace

    Joined:
    Dec 15, 2019
    Posts:
    40
    Thanks very much,but only put animations to subscene is not enough.I try to reviewed the dotssample projected ,I know this project can be builded and i found that the conversion in this project is only used editor too.so i spend sometime and i finaly resoled this problem.it's very simple..
    1.makesure there is the packge: com.unity.platforms.
    2.makesure there is the packge: com.unity.platorms.windows.
    3.right click ->create->build->windows classic build configuration,seleted the created asset,and add the mainscene to the scene list and click the "build" button on the top.
     
  4. kite3h

    kite3h

    Joined:
    Aug 27, 2012
    Posts:
    192
    It is convenient, but you can create a file cache in advance and use it.
     

    Attached Files:

  5. Arnold_2013

    Arnold_2013

    Joined:
    Nov 24, 2013
    Posts:
    281

    Do you have any way to instantiate an animation in a build? My current build shows a "sub-scene animation" working, but I spawn/instantiate units (converted prefabs) and they are in T-pose.

    I tried to just have the 'sub-scene as a prefab' and instantiate a sub-scene with only the animation prefab in it. It does not seem to be possible to instantiate a subscene.

    I tried to have a single animated prefab in the subscene 'as a prefab'. At runtime I locate this entity and use it to instantiate another, but the children are not instanced like a prefab would (there is no prefab tag and no LinkedEntityGroup (tryed in editor)). It would be even better if I could just copy the ComponentData from the 'sub-scene entity' to the not working 'conversion entity', but i have no idea what data is missing in the build, and since it works fine in the editor :confused:.

    The only workaround I can think of is to have a subscene with a huge pool of animated units and resort to a pooling system (I dont know if this will work, but I assume it might).
     
  6. Arnold_2013

    Arnold_2013

    Joined:
    Nov 24, 2013
    Posts:
    281
    Just to answer my own question. I ended up implementing the pooling solution which worked. But it was very limiting. So I went for a second attempt at prefab instancing and this also worked in the build.

    Simply add a component with the prefab to the subscene, and instantiate from this prefab and animations work even in a build.

    Code (CSharp):
    1.  
    2. using Unity.Entities;
    3.  
    4. [GenerateAuthoringComponent]
    5. public struct AnimationPrefabBuilderComponent : IComponentData
    6. {
    7.     public Entity prefab;
    8. }
    9.  
    Code (CSharp):
    1. TryGetSingleton(out AnimationPrefabBuilderComponent animatedSubSceneBuilder)
    Code (CSharp):
    1. ecb.Instantiate(animatedSubSceneBuilder.prefab);
     
    NT_Ninetails likes this.
  7. Endlesser

    Endlesser

    Joined:
    Nov 11, 2015
    Posts:
    89
    Hi guys, how do you put these animations under subscene exactly? I tried to put a Authoring Component Type obj under a subscene and do convert animation clip into BlobAssetReference<Clip> but still got error CS1061.

    Code (CSharp):
    1. using Unity.Entities;
    2. using Unity.Mathematics;
    3. using UnityEngine;
    4. using Unity.Animation.Hybrid;
    5.  
    6. [DisallowMultipleComponent]
    7. public class NewComponent : MonoBehaviour, IConvertGameObjectToEntity
    8. {
    9.     public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    10.     {
    11.         var idleClip = default(AnimationClip);
    12.         var idleClipBar = idleClip.ToDenseClip();
    13.     }
    14. }
    15.  
    Even withdraw all convert scripts from both main scene and subscene, the error still comes up when build.
    Am I heading the wrong direction?

    ---Edit---
    It's fixed, due to old expired animation sample code.
     

    Attached Files:

    Last edited: Jul 7, 2021
  8. wechat_os_Qy0-Dmuhk9wm_zrJcrFib_3Z4

    wechat_os_Qy0-Dmuhk9wm_zrJcrFib_3Z4

    Joined:
    Jan 14, 2021
    Posts:
    3
    hi,can you tell me the details of the fix?
     
  9. Endlesser

    Endlesser

    Joined:
    Nov 11, 2015
    Posts:
    89
    Gladly, make sure `#if UNITY_EDITOR``#endif` is using in your Authoring Component, and under subscene.

    Code (CSharp):
    1. #if UNITY_EDITOR
    2. using Unity.Animation.Hybrid;
    3.  
    4. [ConverterVersion("MyFirstClip_ClipPlayer", 1)]
    5. public class MyFirstClip_ClipPlayer : MonoBehaviour, IConvertGameObjectToEntity
    6. {
    7.     public AnimationClip Clip;
    8.  
    9.     public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    10.     {
    11.         if (Clip == null)
    12.             return;
    13.  
    14.         conversionSystem.DeclareAssetDependency(gameObject, Clip);
    15.  
    16.         dstManager.AddComponentData(entity, new MyFirstClip_PlayClipComponent
    17.         {
    18.             Clip = conversionSystem.BlobAssetStore.GetClip(Clip)
    19.         });
    20.  
    21.         dstManager.AddComponent<DeltaTime>(entity);
    22.     }
    23. }
    24. #endif
     
  10. wechat_os_Qy0-Dmuhk9wm_zrJcrFib_3Z4

    wechat_os_Qy0-Dmuhk9wm_zrJcrFib_3Z4

    Joined:
    Jan 14, 2021
    Posts:
    3
    Thank you,i follow your code and i can pass complulation now.But the build scene is empty. What's wrong with my settings?
     

    Attached Files:

  11. Endlesser

    Endlesser

    Joined:
    Nov 11, 2015
    Posts:
    89
    Last edited: Jul 13, 2021
  12. wechat_os_Qy0-Dmuhk9wm_zrJcrFib_3Z4

    wechat_os_Qy0-Dmuhk9wm_zrJcrFib_3Z4

    Joined:
    Jan 14, 2021
    Posts:
    3