Skip to content

Commit

Permalink
Added showing crashed components in the debugger in red
Browse files Browse the repository at this point in the history
  • Loading branch information
Niikelion committed Jan 8, 2025
1 parent 08a3e79 commit d3428d7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Editor/Debugging/Debugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ private static IComponent RenderNode(CompositionContext.InspectedNode node, int
Text(name, manipulators: new Clickable(OnSelected))
.WithStyle(new(flexGrow: 1, padding: new(left: offset)))
.WithStyle(textStyle)
.WithConditionalStyle(node.Crashed, crashedTextStyle)
.WithConditionalStyle(selected, selectedStyle), () =>
{
var content = children.Select((child, i) => RenderNode(child, level + 1).Id(i+1));
Expand All @@ -222,7 +223,7 @@ private static IComponent RenderNode(CompositionContext.InspectedNode node, int
nobToggleOnly: true,
headerContainer: HeaderContainer,
contentContainer: ContentContainer,
header: Text(name, manipulators: new Clickable(OnSelected)).WithStyle(textStyle),
header: Text(name, manipulators: new Clickable(OnSelected)).WithStyle(textStyle).WithConditionalStyle(node.Crashed, crashedTextStyle),
content: Col(content).WithStyle(fillStyle)
).WithStyle(fillStyle);
}));
Expand Down Expand Up @@ -259,6 +260,7 @@ private static List<CompositionContext> GetInstances() =>
private static readonly Style centerItemsStyle = new(alignItems: Align.Center);
private static readonly Style selectedStyle = new(backgroundColor: new Color(0.17f, 0.36f, 0.53f));
private static readonly Style textStyle = new(color: Color.white);
private static readonly Style crashedTextStyle = new(color: Color.red);
private static readonly Style leftPad = new(padding: new(left: 8));
}
}
1 change: 1 addition & 0 deletions Runtime/CompositionContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ [PublicAPI] public class InspectedNode
public string Name => entry.Component.ToString();
public IComponent Component => entry.Component;
public int Id => entry.Id;
public bool Crashed => entry.Crashed;
public VisualElement RenderedElement => entry.PreviouslyRendered;
public ReadOnlyDictionary<Type, object> Contexts => entry.LocalContexts;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.niikelion.ui.lithium",
"version": "2.1.0",
"version": "2.1.1",
"displayName": "Lithium UI",
"description": "Reactive UI library designed for editor tools creation.",
"unity": "6000.0",
Expand Down

0 comments on commit d3428d7

Please sign in to comment.