-
Notifications
You must be signed in to change notification settings - Fork 77
Worker Inspector window & Entity List #1375
Conversation
workers/unity/Packages/io.improbable.gdk.debug/Improbable.Gdk.Debug.asmdef
Show resolved
Hide resolved
workers/unity/Packages/io.improbable.gdk.debug/WorkerInspector/EntityList.cs
Outdated
Show resolved
Hide resolved
workers/unity/Packages/io.improbable.gdk.debug/WorkerInspector/EntityList.cs
Outdated
Show resolved
Hide resolved
workers/unity/Packages/io.improbable.gdk.debug/WorkerInspector/EntityList.cs
Outdated
Show resolved
Hide resolved
workers/unity/Packages/io.improbable.gdk.debug/WorkerInspector/EntityList.cs
Outdated
Show resolved
Hide resolved
workers/unity/Packages/io.improbable.gdk.debug/WorkerInspector/EntityList.cs
Show resolved
Hide resolved
workers/unity/Packages/io.improbable.gdk.debug/WorkerInspector/EntityList.cs
Outdated
Show resolved
Hide resolved
workers/unity/Packages/io.improbable.gdk.debug/WorkerInspector/WorkerInspectorWindow.cs
Outdated
Show resolved
Hide resolved
|
||
private void OnEntitySelected(EntityId entityId) | ||
{ | ||
UnityEngine.Debug.Log($"Selected {entityId}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug stuff that is removed later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, just a placeholder for now.
|
||
public EntityList() | ||
{ | ||
const string uxmlPath = "Packages/io.improbable.gdk.debug/WorkerInspector/Templates/EntityList.uxml"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have any kind of system or central place to put hard coded references to other packages/assets? Not saying we need to do that here if it's a one-off, but seeing this made me think of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope we don't. Tbh I'd be against a central place since its only referenced here and the locality is nice.
workers/unity/Packages/io.improbable.gdk.debug/WorkerInspector/EntityList.cs
Outdated
Show resolved
Hide resolved
{ | ||
unchecked | ||
{ | ||
return (EntityId.GetHashCode() * 397) ^ (Metadata != null ? Metadata.GetHashCode() : 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is 397 a magic number? I'm not familiar with what it means here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the magic auto-impl of GetHashCode()
by Rider. I believe 397 is a prime number which plays some role in this.
rootVisualElement.styleSheets.Add(stylesheet); | ||
|
||
worldSelector = rootVisualElement.Q<WorldSelector>(); | ||
worldSelector.OnWorldChanged += OnWorldChanged; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to manually remove these callbacks if the window is closed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the window is closed, the world selector element is removed along with it, so its all GC'ed
bf86df6
to
5489e0c
Compare
...ckages/io.improbable.gdk.debug/Tests/Editmode/WorkerInspector/EntitySearchParametersTests.cs
Show resolved
Hide resolved
5489e0c
to
f36e21e
Compare
using Improbable.Gdk.Core; | ||
using Unity.Collections; | ||
using Unity.Entities; | ||
using Unity.Profiling; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, there are ProfilerMarkers
on L12-13.
SonarCloud will flag unused imports now as a code smell 😁
workers/unity/Packages/io.improbable.gdk.debug/WorkerInspector/EntityList.cs
Outdated
Show resolved
Hide resolved
workers/unity/Packages/io.improbable.gdk.debug/WorkerInspector/EntityList.cs
Outdated
Show resolved
Hide resolved
workers/unity/Packages/io.improbable.gdk.debug/WorkerInspector/EntityList.cs
Outdated
Show resolved
Hide resolved
workers/unity/Packages/io.improbable.gdk.debug/WorkerInspector/EntityListData.cs
Outdated
Show resolved
Hide resolved
private EntityQuery query; | ||
private EntitySearchParameters searchParameters; | ||
|
||
public void ApplySearch(EntitySearchParameters searchParameters) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ApplyFilter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer ApplySearch
since the parameter is of type EntitySearchParameters
Kudos, SonarCloud Quality Gate passed! 0 Bugs |
Description
This PR is the first in a series for the Worker Inspector window. In it, we find:
EntityManagerDiffer
to track changes, but this would require the underlying data storage to be equipped for fast additions/removals. For now, I feel what we have is acceptable performanceEntityId
structs, hackyViewVersion
for diff tracking)A quick screenshot, the right hand panel will be used for displaying the detail for a given entity.
Tests
Documentation