Search Unity

  1. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  2. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Participate with students all over the world and build projects to teach people. Join now!
    Dismiss Notice
  5. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Entity Debugger feedback

Discussion in 'Entity Component System and C# Job system' started by Daniel_Brauer, Mar 21, 2018.

  1. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    2,013
    The debugger has sorting by manager name, it also needs sorting by (ms)
    Double clicking on a system name should open its script
     
    TZ-, Daniel_Brauer and Antypodish like this.
  2. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    785
    (From Unite Berlin talk, sorting by system execution order on a given frame is coming. Also better visualization together with other non ECS scrips in PlayerLoop.)
     
    TZ-, Daniel_Brauer and laurentlavigne like this.
  3. zulfajuniadi

    zulfajuniadi

    Joined:
    Nov 18, 2017
    Posts:
    117
    Do you guys have a github repo that I can send pull request to? I'm making a custom EditorWindow to view running properties of a system. I think other people might need the same functionality as well.

    It supports basic fields such as strings, int, enums as well as object fields too.

    Here's what I have so far:

    upload_2018-6-28_0-47-58.png

    Link to thread and code
     
    Last edited: Jun 30, 2018
  4. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    2,013
    +option to hide non running systems
     
  5. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    338
    Seems like sometimes it does not scale properly. I think it will be really nice if user can change the scale by dragging the bottom line.

    upload_2018-9-14_2-18-35.png
     
    noio and Daniel_Brauer like this.
  6. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    2,442
    Just came into similar matter
    upload_2018-9-14_13-41-48.png

    Would like to be expandable.
     
  7. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,351
    Just so we're clear: this is the exact same issue?
     
  8. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    2,442
    Providing I understand the author, that requirements is to drag bottom line, to expand and display more groups at once,

    then I would say yes.
     
  9. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,351
    Good, yes. I am planning on making all the dividers draggable.
     
    optimise and Antypodish like this.
  10. sient

    sient

    Joined:
    Aug 9, 2013
    Posts:
    584
    Is it possible to add a system filter/search input box that filters by system name? It can sometimes take me 20+ seconds to find a specific system (I only have ~40, and I can only imagine how much more time it will take when there are 100s).

    This didn't used to be as bad, since the systems were ordered alphabetically, but now they are ordered by update order, which from the perspective of picking out the system is close to random.
     
    Daniel_Brauer likes this.
  11. nbmc

    nbmc

    Joined:
    Jun 30, 2016
    Posts:
    1
    Hi,

    I'm catching up on recent ECS changes and working on some of the areas I haven't looked at before. My attention was grabbed by the reactive systems so I started playing around with them to see if I could get them working. For the most part I have, but when I use the EntityDebugger to look at the values stored within an entity's component, the moment I select the entity it begins triggering the [ChangedFilter] job I set up to track component changes. It continues to do this until I select an entity that doesn't contain the component I'm tracking changes in or I close the Entity Debugger window.

    The following code attached to a GameObject in an empty ECS project should be able to trigger it. It's supposed to just display a log entry whenever the spacebar is pressed or released. It does this, and then so much more once Entity 0 is selected in the debugger.

    Code (csharp):
    1.  
    2. using Unity.Entities;
    3. using UnityEngine;
    4.  
    5. public class Bootstrap : MonoBehaviour
    6. {
    7.     void Start()
    8.     {
    9.         var entityManager = World.Active.GetOrCreateManager<EntityManager>();
    10.         entityManager.CreateEntity(
    11.             ComponentType.Create<PlayerInput>()
    12.             );
    13.         entityManager.CreateEntity();
    14.     }
    15. }
    16.  
    17.  
    18. public struct PlayerInput : IComponentData
    19. {
    20.     public int ButtonPressed;
    21. }
    22.  
    23. public class PlayerInputSystem : ComponentSystem
    24. {
    25.     public struct Data
    26.     {
    27.         public readonly int Length;
    28.         public EntityArray Entities;
    29.         public ComponentDataArray<PlayerInput> PlayerInput;
    30.     }
    31.     [Inject] Data m_Data;
    32.  
    33.     protected override void OnUpdate()
    34.     {
    35.         if(Input.GetKeyDown("space"))
    36.         {
    37.             for(int i = 0; i < m_Data.Length; i++)
    38.             {
    39.                 PostUpdateCommands.SetComponent<PlayerInput>(m_Data.Entities[i], new PlayerInput { ButtonPressed = 1 });
    40.             }
    41.         }
    42.         if(Input.GetKeyUp("space"))
    43.         {
    44.             for(int i = 0; i < m_Data.Length; i++)
    45.             {
    46.                 PostUpdateCommands.SetComponent<PlayerInput>(m_Data.Entities[i], new PlayerInput { ButtonPressed = 0 });
    47.             }
    48.         }
    49.     }
    50. }
    51.  
    52. public class PlayerInputChangeSystem : ComponentSystem
    53. {
    54.     public struct PlayerInputState : ISystemStateComponentData
    55.     {
    56.         public PlayerInput value;
    57.     }
    58.  
    59.     public struct AddedPlayerInputComponent
    60.     {
    61.         public readonly int Length;
    62.         public EntityArray Entities;
    63.         public ComponentDataArray<PlayerInput> PlayerInput;
    64.         public SubtractiveComponent<PlayerInputState> _PlayerInputState;
    65.     }
    66.     [Inject] AddedPlayerInputComponent m_AddedPlayerInputComponent;
    67.  
    68.     public struct RemovedPlayerInputComponent
    69.     {
    70.         public readonly int Length;
    71.         public EntityArray Entities;
    72.         public SubtractiveComponent<PlayerInput> PlayerInput;
    73.         public ComponentDataArray<PlayerInputState> PlayerInputState;
    74.     }
    75.     [Inject] RemovedPlayerInputComponent m_RemovedPlayerInputComponent;
    76.  
    77.     struct ChangeJob : IJobProcessComponentData<PlayerInput>
    78.     {
    79.         public void Execute([ChangedFilter] ref PlayerInput InputData)
    80.         {
    81.             if(InputData.ButtonPressed == 1)
    82.             {
    83.                 Debug.Log("Detected Change: Button Pressed");
    84.             }
    85.             else
    86.             {
    87.                 Debug.Log("Detected Change: Button Released");
    88.             }
    89.         }
    90.     }
    91.  
    92.     protected override void OnUpdate()
    93.     {
    94.         for(int i = 0; i < m_AddedPlayerInputComponent.Length; i++)
    95.         {
    96.             Debug.Log("Component PlayerInput added to Entity " + m_AddedPlayerInputComponent.Entities[i]);
    97.             PostUpdateCommands.AddComponent<PlayerInputState>(m_AddedPlayerInputComponent.Entities[i], new PlayerInputState());
    98.         }
    99.  
    100.         for(int i = 0; i < m_RemovedPlayerInputComponent.Length; i++)
    101.         {
    102.             Debug.Log("Component PlayerInput removed from Entity " + m_RemovedPlayerInputComponent.Entities[i]);
    103.             PostUpdateCommands.RemoveComponent<PlayerInputState>(m_RemovedPlayerInputComponent.Entities[i]);
    104.         }
    105.  
    106.         // Tracking changes in components in entities .....
    107.         var job = new ChangeJob();
    108.         job.Run(this);
    109.     }
    110. }

    Is this expected behaviour from the debugger, am I doing something wrong (in which case this is probably the wrong thread sorry!) or some sort of debugger problem?

    Thanks!
     
    Daniel_Brauer likes this.
  12. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,351
    This is a bug. Thanks for reporting it!
     
  13. julian-moschuering

    julian-moschuering

    Joined:
    Apr 15, 2014
    Posts:
    229
    EntityDebugger doesn't find EntityArchetypeQuerys in an array as it only checks the field type. I use multiple queries and collect the Archetypes and the get the chunks. Unfortunately the queries don't show up in the debugger:
    Code (CSharp):
    1. EntityArchetypeQuery[] queries;
    I undestand that in this usecase the debugger is not able to group the queries correctly.
     
    Last edited: Oct 1, 2018
  14. julian-moschuering

    julian-moschuering

    Joined:
    Apr 15, 2014
    Posts:
    229
    Is it a known issue, that SharedComponents are not correclty shown and updated
    Names of shared components are missing and the values seem to be the initial ones and don't get updated.
     
  15. SubPixelPerfect

    SubPixelPerfect

    Joined:
    Oct 14, 2015
    Posts:
    159
    UPDATE: Partially fixed in 0.0.12.preview21


    Entity Debugger UI has some bug in preview 17

    2018-10-07_214021.jpg

    Code (CSharp):
    1.  
    2. public struct Age : IComponentData{
    3.   public float Value;
    4. }
    5. public class AgeSystem:ComponentSystem{
    6.     private struct AgeData{
    7.       public ComponentDataArray<Age> AgeComponents;
    8.       public EntityArray Entities;
    9.       public readonly int Length;
    10.     }
    11.     [Inject] private AgeData _data;
    12.     protected override void OnUpdate(){    }
    13. }
    Why Age Component listed 3 times?
     
    Last edited: Nov 29, 2018
    ChrisPie likes this.
  16. Sylmerria

    Sylmerria

    Joined:
    Jul 2, 2012
    Posts:
    161
    Hi,

    half from math package are not well serialized

     
  17. Adam-Mechtley

    Adam-Mechtley

    Unity Technologies

    Joined:
    Feb 5, 2007
    Posts:
    170
    Hi! I have discussed this in another thread.
     
    Sylmerria likes this.
  18. Xerioz

    Xerioz

    Joined:
    Aug 13, 2013
    Posts:
    57
    Any way of making my manually updated systems visible inside Entity Debugger?

    Looking at the debugger code, it seems that I need to somehow include my systems in ScriptBehaviourUpdateOrder.CurrentPlayerLoop.subSystemList without making them run.
    It's kind of hard since I have my own custom loop.

    So far I'm just choosing my world and clicking on entity > systems > show my system. This doesn't seem like a practical way of using this debugger.
     
  19. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    655
    Please make containers resizable, because now it is very uncomfortable :( If I have many Archetypes, finding which I want is hell.
    upload_2018-10-31_10-17-33.png
     
  20. Razmot

    Razmot

    Joined:
    Apr 27, 2013
    Posts:
    223
    - Need to search entity by ID .
    Use case : I have a hybrid setup, mesh renderers on monobehaviour . I display the entity ID on a public field in my mono, but I have to manually look for the entity ID.
    Proposal : Just typing the id in the search field.
    Nice to have : opening the entity inspector directly from a click on the entity id from the monobehaviour inspector.

    -Need to have an entity inspector window that stays focused on the current entity, independently of what is focused in the monobehaviour inspector.
    -Use case : investigating / comparing mono and ecs sides in an hybrid setup.
    -Proposal : dedicated entity inspector window, or lock in "entity mode"

    -Need to have the dynamicbuffers content collapsed by default.
    -Use case : multiple dynamicbuffers with lots of values on an entity, makes the inspector lag but all I want is check another component that is displayed after the buffers contents !
    -Proposal : Collapse by default

    -Need to Identity data by name
    -Use case : Entities are just numeric data, hard to figure who's who.
    -Proposal : some sort of [ShowInInspector] attribute that can be put on the ToString() method
     
    TZ- and e199 like this.
  21. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    386
    I think an attribute would be better.

    [EntityTag] Player : IComponentData {}


    Turns "Player" into a tag next to the entity. Optionally with customizable color in the attribute or in Editor. I think this is the best option since it allows for multiple tags and colors.

    [EntityName] Gun : IComponentData {}


    Could replace entity name "Entity" with this type name, "Gun" in this case.
     
  22. Derebeyi

    Derebeyi

    Joined:
    Jun 3, 2015
    Posts:
    7
    I don't know if it's a bug or it's just me messing up,but when I schedule multi-frame jobs debugger goes nuts.

    I get many errors:

    InvalidOperationException: The previously scheduled job ProductionSystem:productionRawAmountsJob reads from the NativeArray ProductionRawAmountsJob.factoryIDs. You must call JobHandle.Complete() on the job ProductionSystem:productionRawAmountsJob, before you can deallocate the NativeArray safely.
    Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckDeallocateAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) <0x44cdbae0 + 0x00052> in <876a68e108084c979db9310b979692bb>:0
    Unity.Entities.ComponentJobSafetyManager.CompleteAllJobsAndInvalidateArrays () (at Library/PackageCache/com.unity.entities@0.0.12-preview.19/Unity.Entities/ComponentJobManager.cs:104)
    Unity.Entities.EntityManager.CompleteAllJobs () (at Library/PackageCache/com.unity.entities@0.0.12-preview.19/Unity.Entities/EntityManager.cs:797)
    Unity.Entities.Editor.EntityListView.BuildRows (UnityEditor.IMGUI.Controls.TreeViewItem root) (at Library/PackageCache/com.unity.entities@0.0.12-preview.19/Unity.Entities.Editor/EntityDebugger/EntityListView.cs:94)
    UnityEditor.IMGUI.Controls.TreeView+TreeViewControlDataSource.FetchData () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControlDataSource.cs:58)
    UnityEditor.IMGUI.Controls.TreeViewDataSource.ReloadData () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewDataSource.cs:53)
    UnityEditor.IMGUI.Controls.TreeView+TreeViewControlDataSource.ReloadData () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControlDataSource.cs:25)
    UnityEditor.IMGUI.Controls.TreeViewController.ReloadData () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:289)
    UnityEditor.IMGUI.Controls.TreeView.Reload () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControl.cs:105)
    Unity.Entities.Editor.EntityListView.UpdateIfNecessary () (at Library/PackageCache/com.unity.entities@0.0.12-preview.19/Unity.Entities.Editor/EntityDebugger/EntityListView.cs:65)
    Unity.Entities.Editor.EntityDebugger.OnGUI () (at Library/PackageCache/com.unity.entities@0.0.12-preview.19/Unity.Entities.Editor/EntityDebugger/EntityDebugger.cs:451)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:342)
    UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:336)
    UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:310)
    UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect, System.Boolean customBorder, System.Boolean floatingWindow, System.Boolean isBottomTab) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:363)
    UnityEditor.DockArea.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:322)
    UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:244)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
    ArgumentException: Getting control 0's position in a group with only 0 controls when doing repaint
    Abortin
    Disposing EntityManager but a job is still running against the ComponentData. It appears the job has not been registered with JobComponentSystem.AddDependency.
    UnityEngine.Debug:LogError(Object)

    If don't stay or click on debugger window everything works fine.Even with exceptions systems continue to work.Jobs have their dependencies and I tried with and without Burst.
     
  23. BanJaxe

    BanJaxe

    Joined:
    Nov 20, 2017
    Posts:
    16
    Seems like the Entity Debugger doesn't show entities/components that only last for a single frame. e.g. Input event entities that are created at the start of the frame, possibly some systems process them, and then at the end of the frame a system destroys them.

    Would be useful if it could show recently (this frame or last frame) created/destoryed entities and components.
     
    Last edited: Nov 7, 2018
  24. TZ-

    TZ-

    Joined:
    Oct 23, 2017
    Posts:
    18
    Not sure if it is related but when i select an entity that has multiple buffers on it, the editor just locks up (not responding), it is not using much of my cpu or ram, but no matter how long i wait it remains unresponsive.
     
  25. wobes

    wobes

    Joined:
    Mar 9, 2013
    Posts:
    497
    @Daniel_Brauer

    Good day. Can we have support for IntPtr? Or at least have an ability to hide it. Because clicking on an entity that has IntPtr in its IComponentData throws an exception: "NotSupportedException: Primitive field type System.IntPtr is not supported".


    Code (CSharp):
    1.  
    2.     public struct NetworkPacket : IComponentData
    3.     {
    4.         public IntPtr Data;
    5.     }
     
  26. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,351
    Thanks, I've added an issue to track this.
     
    wobes likes this.
  27. Jes28

    Jes28

    Joined:
    Sep 3, 2012
    Posts:
    231
    Hi.

    I have got few bugs with debugger :)

    - If component system lies in file with different name than system itself, it will not show up in EntityDebugger
    - Entity Debugger not showing backing fields from auto properties

    Is They known?

    I have one more but don't know where to post it:
    - If system class name don't have postfix 'System' than Unity spawn error: missing the class attribute 'ExtensionOfNativeClass'!
     
  28. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,351
    Thanks! Please file bugs using the bug reporter. They will make it to the ECS team.
     
  29. Jes28

    Jes28

    Joined:
    Sep 3, 2012
    Posts:
    231
    2 of 3 bugs gone in b 12.

    Remaining ones are there (Case 1106855) EntityDebugger show incorrect entity data in inspector

    :)
     
  30. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    785
    Please use white font for `Entity` field for dark skin.

    Screenshot 2018-12-10 02.00.56.png

    (And also just discovered that double clicking the text takes me to that entity. Why no advertisement for such an awesome feature?? Nice easter egg!)
     
  31. Jes28

    Jes28

    Joined:
    Sep 3, 2012
    Posts:
    231
    I Think PlayerLoop part of debugger will become core part of Unity workflow because it shows up our GameFlow in one place. Most games will have 100+ systems and there must be LogicalGroups for organisation purposes like ShootingGroup on image, but must be inside Update not near it. [UpdateInGroup] attribute already can be used for this kind of grouping.

    For now debugger can show only first 2 levels of systems that is bad and uncomfortable to work with.
    We have big plain list of working systems without any grouping by purpose

    Unity Fps shooter adds new thing called Module and I think it is good way to organize things and understand in PlayerLoop to what some system belongs to, so when I add package from store to game I can see all systems that was added from that package and where. System belonging to different Modules tagged by different colors on image.

    resume:
    - we need logical groups for Clean structural organisation of PlayerLoop
    - we need nesting deeper than 2 systems deep, atlast 3-4 but better show as any nesting
    - wen need tags on systems to differentiate systems in big list (e.g. Model from their View from their network from some modifiers...) I propose tags based on namespaces aka modules.

    Additionaly think "EntityDebugger" must be renamed into something like "GameLoop" and must become core UI window in Unity and what it touch (entities, input devices, monobehaviours...)
     
  32. Jes28

    Jes28

    Joined:
    Sep 3, 2012
    Posts:
    231
  33. Jes28

    Jes28

    Joined:
    Sep 3, 2012
    Posts:
    231
    Debugger fails to draw entire window if some system added twice to player loop