Entitas icon indicating copy to clipboard operation
Entitas copied to clipboard

Request: Visual debugging customisation

Open FNGgames opened this issue 7 years ago • 9 comments

When you have an entity with 30+ components as I regularly do, and when these components each perform very different functions, e.g. physics (Position/Mass/Drag/Velocity...), AI (Faction/Friends/Enemies...), view (Asset, Color, ViewController...) etc., it gets really difficult to navigate the visual debugging inspector.

I'd like to be able to customize the way the components are drawn on the Visual Debugging game objects. I'd like to be able to group them by function, add titles to groups and customize each component's color individually so I can color code based on function. Can we have a UI for this in unity please?

FNGgames avatar Jan 12 '18 10:01 FNGgames

There's a search field which supports fuzzy search, e.g to show Asset, Color, ViewController you can write "as co vi". This will filter all matching components.

Based on my current plans, I cannot see myself adding sth like this. This would be a community driven feature. I recommend looking these classes to get started

sschmid avatar Jan 12 '18 20:01 sschmid

Sounds like you want something like features, but for components instead of systems. Perhaps you could create your own add-on from the source code to that?

IsaiahKelly avatar Jan 13 '18 02:01 IsaiahKelly

If i had the time to create the addon myself i wouldn't have requested it here, but thanks anyway.

@IsaiahKelly it would be more like a dropdown window that lets you define the order that components get drawn in the entity inspector, and a color picker for each one.

FNGgames avatar Jan 15 '18 10:01 FNGgames

Maybe sth like a IComponentsGroupDrawer

public class ViewDrawer : IComponentsDrawer {

    public string title { get { return "View"; } }
    public Color color { get { return Color.red; } }
    public int priority { get { return 0; } }

    public Type[] components {
        get {
            return new [] {
                typeof(AssetComponent),
                typeof(Color),
                typeof(ViewController)
            };
        }
    }
}

sschmid avatar Jan 15 '18 17:01 sschmid

The EntityDrawer could draw all component groups based on prio first and then all remaining components as usual

sschmid avatar Jan 15 '18 17:01 sschmid

Or maybe sth like this instead

[DrawInGroup("View")]
public sealed class AssetComponent : IComponent {
    public string value;
}

// In  ViewGroupDrawer.cs
public class ViewGroupDrawer : IComponentsDrawer {

    public string title { get { return "View"; } }
    public Color color { get { return Color.red; } }
    public int priority { get { return 0; } }
}

sschmid avatar Jan 15 '18 17:01 sschmid

oooor maybe not have an IComponentsDrawer at all and [DrawInGroup("View")] dynamically creates Groups, because we have the title already and it gets a random (but deterministic) color assigned. Ordered alphabetically

sschmid avatar Jan 15 '18 17:01 sschmid

Thanks for the starting material, if i come up with something I'll certainly share it. I think the simple [DrawInGroup("View")] tag would be all the functionality i need. I'll have a tinker.

FNGgames avatar Jan 16 '18 09:01 FNGgames

Another useful customization that would help is to allow us to not show entities with specific components in visual debugging. For example I create and clean up some "temporary" entities every frame. It's not a big deal thank to Entitas' pooling. The problem is, visual debugging creates a GameObject for each of them and it completely ruins the performance. Disabling visual debugging fixes that, but it would be better if we could only turn it off for these entities.

yhslai avatar Mar 08 '18 10:03 yhslai