Class Node
A base class for behaviour nodes used in the Behavior graph.
Inherited Members
Namespace: Unity.Behavior
Assembly: Unity.Behavior.dll
Syntax
[Serializable]
public abstract class Node
Properties
CurrentStatus
The current status of the graph node.
Declaration
[CreateProperty]
public Node.Status CurrentStatus { get; protected set; }
Property Value
GameObject
The game object that contains the BehaviorGraphAgent
that is running the behavior graph.
Declaration
public GameObject GameObject { get; }
Property Value
Type | Description |
---|---|
Game |
Methods
AwakeNode(Node)
Awakens a node if it is currently waiting on a child node or branch.
Declaration
protected void AwakeNode(Node node)
Parameters
Type | Name | Description |
---|---|---|
Node | node | The node to awaken. |
AwakeParents()
AwakeParents is called after the running node has returned a status of Success or Fail.
Declaration
protected virtual void AwakeParents()
EndNode(Node)
Ends the execution of the specified node.
Declaration
protected void EndNode(Node node)
Parameters
Type | Name | Description |
---|---|---|
Node | node | The node for which execution should end |
LogFailure(string, bool)
Log failure to the editor with additional contextual data.
Declaration
public void LogFailure(string reason, bool isError = false)
Parameters
Type | Name | Description |
---|---|---|
string | reason | Reason for the failure. |
bool | isError | If true, report the message using LogError instead of LogWarning. |
OnDeserialize()
Message raised after a graph is deserialized. Can be use to restart waiting nodes or reconstruct complex data that cannot be serialized.
Declaration
protected virtual void OnDeserialize()
OnEnd()
OnEnd is called when the node has stopped running.
Declaration
protected virtual void OnEnd()
OnSerialize()
Message raised before a graph is serialized. Can be use to prepare data for deserialization.
Declaration
protected virtual void OnSerialize()
OnStart()
OnStart is called when the node starts running.
Declaration
protected virtual Node.Status OnStart()
Returns
OnUpdate()
OnUpdate is called each frame while the node is running.
Declaration
protected virtual Node.Status OnUpdate()
Returns
ResetStatus()
Resets the current status of the node.
Declaration
protected virtual void ResetStatus()
StartNode(Node)
Starts the specified node. If the node completes, the parent node is notified.
Declaration
protected Node.Status StartNode(Node node)
Parameters
Type | Name | Description |
---|---|---|
Node | node | The node to start |