Skip to content

Commit 1752787

Browse files
committed
Add minimal soft breakpoint support
1 parent c0ff3be commit 1752787

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

Editor/Core/UI/LogWindow-DebugChan.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,23 @@ public partial class LogWindow{ // Debug-Chan
99
// From DebugChan
1010
public void OnGenericMessage(string message, object sender, int messageCount){
1111
cumulatedMessageCount = messageCount;
12+
if(Config.useSelection && model.current == null){
13+
if(sender is GameObject){
14+
model.current = sender as GameObject;
15+
Debug.Log($"Make current {model.current}");
16+
}
17+
if(sender is Component){
18+
model.current = (sender as Component).gameObject;
19+
Debug.Log($"Make current {model.current}");
20+
}
21+
}
22+
if(breakpoint != null && message.ToLower().Contains(breakpoint.ToLower())){
23+
Debug.Break();
24+
Debug.Log($"Break on {message} from {sender}");
25+
if(sender is GameObject){
26+
model.current = sender as GameObject;
27+
}
28+
}
1229
if(isPlaying && instance){
1330
instance.DoUpdate(null);
1431
}

Editor/Core/UI/LogWindow.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public partial class LogWindow : EditorWindow{
1414
const float ScrubberButtonsHeight = 24f;
1515
public static LogWindow instance;
1616
LogWindowModel model = new LogWindowModel();
17+
string breakpoint;
1718
//
1819
static Font normalButtonFont;
1920
static Font _font;
@@ -44,8 +45,9 @@ void OnGUI(){
4445
}
4546
return;
4647
}
47-
//
48-
model.current = Selection.activeGameObject;
48+
if(Selection.activeGameObject){
49+
model.current = Selection.activeGameObject;
50+
}
4951
instance = this;
5052
if(isPlaying) time = Time.time;
5153
DrawScrubber();
@@ -60,6 +62,8 @@ void OnGUI(){
6062
}
6163

6264
void DrawFooter(){
65+
breakpoint = EGL.DelayedTextField("Breakpoint", breakpoint)?.Trim();
66+
if(breakpoint?.Length == 0) breakpoint = null;
6367
BeginHorizontal();
6468
// ◎
6569
Config.useSelection = ToggleLeft("Use Selection", Config.useSelection,

0 commit comments

Comments
 (0)