Custom Task Migration
Behavior trees authored in Behavior Designer version 1 cannot be converted to Behavior Designer Pro, but custom Tasks port with a contained set of changes. This page maps the version 1 API onto its Behavior Designer Pro equivalent.
Review the original task
A representative version 1 Action:
using UnityEngine;
using BehaviorDesigner.Runtime;
using BehaviorDesigner.Runtime.Tasks;
using Tooltip = BehaviorDesigner.Runtime.Tasks.TooltipAttribute;
namespace MyNamespace
{
[TaskCategory("Common")]
[TaskIcon("Assets/MyIcon.png")]
[TaskDescription("Logs to the console.")]
public class MyTask : Action
{
[Tooltip("Text to output to the log")]
public SharedString text;
public override TaskStatus OnUpdate()
{
Debug.Log(text.Value);
return TaskStatus.Success;
}
public override void OnReset()
{
// Reset the properties back to their original values
text = "";
}
}
}
Update namespaces
BehaviorDesigner.Runtime no longer exists. Its contents are split across the Behavior Designer and Graph Designer packages:
| Namespace | Contains |
|---|---|
Opsive.BehaviorDesigner.Runtime.Tasks |
The TaskStatus definition. |
Opsive.BehaviorDesigner.Runtime.Tasks.Actions / .Conditionals |
The parent Action and Conditional classes. |
Opsive.GraphDesigner.Runtime |
The node attributes. |
Opsive.GraphDesigner.Runtime.Variables |
The Shared Variable system. |
Update attributes
| Version 1 | Behavior Designer Pro |
|---|---|
TaskIcon |
NodeIcon. Accepts an asset path or an asset GUID, and an optional second value used as the light-theme icon. |
TaskDescription |
Opsive.Shared.Utility.Description. |
TaskCategory |
Opsive.Shared.Utility.Category. |
HelpURL |
No longer used. |
Tooltip |
Unity’s own Tooltip attribute. The version 1 alias is no longer required. |
NodeDescription also exists in Opsive.GraphDesigner.Runtime but is deprecated. Use Opsive.Shared.Utility.Description for new and migrated Tasks; it is what the included Tasks use.
Update variables and method names
- Shared Variables are generic. Purpose-built types such as
SharedStringare no longer needed — declareSharedVariable<string>instead. OnResetis nowReset.
Use the Behavior Designer Pro task
The same Task after migration:
using UnityEngine;
using Opsive.BehaviorDesigner.Runtime.Tasks;
using Opsive.BehaviorDesigner.Runtime.Tasks.Actions;
using Opsive.GraphDesigner.Runtime;
using Opsive.GraphDesigner.Runtime.Variables;
namespace MyNamespace
{
[Opsive.Shared.Utility.Category("Common")]
[NodeIcon("Assets/MyIcon.png")]
[Opsive.Shared.Utility.Description("Logs to the console.")]
public class MyTask : Action
{
[Tooltip("Text to output to the log")]
[SerializeField] protected SharedVariable<string> m_Text;
public override TaskStatus OnUpdate()
{
Debug.Log(m_Text.Value);
return TaskStatus.Success;
}
public override void Reset()
{
// Reset the properties back to their original values
m_Text = string.Empty;
}
}
}
The included Tasks declare their fields as [SerializeField] protected with an m_ prefix rather than as public fields. Either form serializes; the convention above matches the rest of the package.
Related pages
- New Tasks for the full authoring reference.
- GameObject Task for the component-based route.
- Version Comparison for the product-level differences.