diff --git a/Engine.Core/Extensions/BehaviourControllerExtensions.cs b/Engine.Core/Extensions/BehaviourControllerExtensions.cs index 01a0c5d..5665307 100644 --- a/Engine.Core/Extensions/BehaviourControllerExtensions.cs +++ b/Engine.Core/Extensions/BehaviourControllerExtensions.cs @@ -6,6 +6,9 @@ namespace Syntriax.Engine.Core; public static class BehaviourControllerExtensions { + public static T GetOrAddBehaviour(this IBehaviourController behaviourController, params object?[]? args) where T : class, IBehaviour + => behaviourController.GetBehaviour() ?? behaviourController.AddBehaviour(args); + public static bool TryGetBehaviourInParent(this IBehaviourController behaviourController, [NotNullWhen(returnValue: true)] out T? behaviour) where T : class { behaviour = GetBehaviourInParent(behaviourController);