Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

When would be possible to sync scene objects in runtime with Dots component

Discussion in 'Entity Component System' started by mmortall, May 2, 2020.

  1. mmortall

    mmortall

    Joined:
    Dec 28, 2010
    Posts:
    89
    For example, I have a subscene with some objects and I want to select them after they are converted to dots in runtime at least to see where they are, focus camera, see how they are moving etc. It would be great to have some kind of sync between key components like Visibility, Translate and Rotate to Transform component of GameObject. Is it in plans or maybe there are some extended tools already?
    Thanks.
     
  2. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,697
    I know of CopyTransformFromGameObject for transforms
     
    mmortall likes this.
  3. mmortall

    mmortall

    Joined:
    Dec 28, 2010
    Posts:
    89
    No I need the opposite. Reapply transforms to scene model entity was created from.

    I've written a system to do it. Probably a Live LInk should do the same and EditorRenderData has some clear purpose but it is not working for me for some reason.

    Code (CSharp):
    1.  
    2. public class DOTStoSceneLink : JobComponentSystem
    3. {
    4.     protected override JobHandle OnUpdate(JobHandle inputDeps)
    5.     {
    6.         Entities.ForEach((ref Translation data, ref Rotation rot, in EditorRenderData editorRenderData) =>
    7.         {
    8.             if (editorRenderData.PickableObject != null)
    9.             {
    10.                 editorRenderData.PickableObject.transform.position = data.Value;
    11.                 editorRenderData.PickableObject.transform.rotation = rot.Value;
    12.             }
    13.         }).WithoutBurst().Run();
    14.  
    15.         return default;
    16.     }
    17. }
    18.