Add GetDebugInfo to BT nodes for debugging

This commit is contained in:
Wojtek Figat
2023-09-19 20:57:19 +02:00
parent f845344d03
commit 336fe46e03
12 changed files with 225 additions and 20 deletions

View File

@@ -449,6 +449,18 @@ namespace FlaxEditor.Windows.Assets
UpdateKnowledge();
}
private void UpdateDebugInfos(bool playMode)
{
var behavior = playMode ? (Behavior)_behaviorPicker.Value : null;
if (!behavior)
behavior = null;
foreach (var e in _surface.Nodes)
{
if (e is Surface.Archetypes.BehaviorTree.NodeBase node)
node.UpdateDebug(behavior);
}
}
/// <inheritdoc />
public override void OnPlayBegin()
{
@@ -461,6 +473,7 @@ namespace FlaxEditor.Windows.Assets
public override void OnPlayEnd()
{
SetCanEdit(true);
UpdateDebugInfos(false);
base.OnPlayEnd();
}
@@ -520,6 +533,12 @@ namespace FlaxEditor.Windows.Assets
// Update behavior debugging
SetCanDebug(Editor.IsPlayMode && _behaviorPicker.Value);
// Update debug info texts on all nodes
if (Editor.IsPlayMode)
{
UpdateDebugInfos(true);
}
base.Update(deltaTime);
}