基于 GraphView 的 Unity 行为树设计器,免费使用。
Free Behavior Tree designer for Unity.
I know some designers like Behavior Designer or Arbor3.
They have many features but not for free.
I will provide easily customizable and free designer.
Packages/manifest.json:{
"dependencies": {
...
"com.github.yoshidan.unibt": "https://github.com/yoshidan/UniBT.git?path=Assets/UniBT/Scripts"
}
}
Add UniBT.BehaviorTree component for any GameObject.
Open Graph Editor button opens GraphView for Behavior Tree.
Add behaviors and set parameters.
Finally press save button on tool bar of the editor window. (If invalid node found the color of the node become red.)
Run the unity application. you can see node status in the editor window.
Update returned Status.Failure`.Update returned Status.Success.Update returned Status.Running.you can save the GameObject with UniBT.BehaviorTree as prefab.
UnitBT.BehaviorTree updates child nodes in Update timing when the UpdateType is UpdateType.Auto.UpdateType.Manual and call BehaviorTree.Tick();UniBT.BehaviorTree is the MonoBehavior. Each node is just a C# Serializable class.| Name | Description |
|---|---|
| Composite Node | It has one or more child nodes and controls which child node to update. |
| Action Node | This is the leaf node. It execute action such as follow player, attack, escape or others you define. |
| Conditional Node | It has one child node and check the condition whether child is updatable. when having no child, Conditional Node is the leaf node like Action Node. |
Conditional Node has following parameter.
| Name | Description |
|---|---|
| dontReEvaluateOnRunning | true: don't re evaluate the condition if the previous status is Status.Running. |
I have prepared several built in Composite Node.
Sequence has following parameter.
| Name | Description |
|---|---|
| abortOnConditionChanged | true: Aborts the running node when a node with a higher priority than the running node becomes infeasible. Specifically, the execution result of Conditional.CanUpdate, which is a descendant of a node with a higher priority than the running node, is used. |
Selector has following parameter.
| Name | Description |
|---|---|
| abortOnConditionChanged | true: Aborts the running node when a node with a higher priority than the running node becomes executable. Specifically, the execution result of Conditional.CanUpdate, which is a descendant of a node with a higher priority than the running node, is used. |
Rotator has following parameter.
| Name | Description |
|---|---|
| resetOnAbort | It is a flag whether to return the next execution target node from the top when the execution condition of the ancestor Conditional Node changes and the running node is interrupted. |
UniBT.ActionOnUpdate and return status(Success/Running/Failure).Awake called by UniBT.BehaviorTree.Awake if needed.Start called by UniBT.BehaviorTree.Start if needed.Abort to reset field or any state when the parent condition changed..gameObject field with UniBT.BehaviorTree attached.public class Wait : Action
{
[SerializeField]
private float waitTime;
private float elapsedTime = 0.0f;
protected override Status OnUpdate()
{
elapsedTime += Time.deltaTime;
if (elapsedTime ();
}
protected override bool IsUpdatable()
{
return enemy.Hate > threshold;
}
}
Conditional Node can be leaf node like Action Node.
Conditional Node can be branch node.
UniBT.CompositeOnUpdate and return status(Success/Running/Failure).OnAwake called by UniBT.BehaviorTree.Awake if needed.OnStart called by UniBT.BehaviorTree.Start if needed.Abort.gameObject field with UniBT.BehaviorTree attached.…
暂无开放 Issues,或尚未同步最近议题。