Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Core/BonsaiTreeComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Bonsai.Core
{
public class BonsaiTreeComponent : MonoBehaviour
public class BonsaiTreeComponent : MonoBehaviour, IViewInBonsaiTreeWindow
{
/// <summary>
/// The tree blueprint asset used.
Expand Down
7 changes: 7 additions & 0 deletions Core/IViewInBonsaiTreeWindow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Bonsai.Core
{
public interface IViewInBonsaiTreeWindow
{
BehaviourTree Tree { get; }
}
}
3 changes: 3 additions & 0 deletions Core/IViewInBonsaiTreeWindow.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Editor/BonsaiWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ private void SwitchToViewModeIfRequired()
return;
}

var btc = Selection.activeGameObject.GetComponent<BonsaiTreeComponent>();
BehaviourTree treeToView = btc ? btc.Tree : null;
var btc = Selection.activeGameObject.GetComponent<IViewInBonsaiTreeWindow>();
BehaviourTree treeToView = btc != null ? btc.Tree : null;

// There must be a non-null tree to view,
// it must be a different tree than the active tree for this window,
Expand Down