docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class Node

    A base class for behaviour nodes used in the Behavior graph.

    Inheritance
    object
    Node
    Action
    Composite
    Join
    Modifier
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    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
    Type Description
    Node.Status

    GameObject

    The game object that contains the BehaviorGraphAgent that is running the behavior graph.

    Declaration
    public GameObject GameObject { get; }
    Property Value
    Type Description
    GameObject

    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
    Type Description
    Node.Status

    The status of the node.

    OnUpdate()

    OnUpdate is called each frame while the node is running.

    Declaration
    protected virtual Node.Status OnUpdate()
    Returns
    Type Description
    Node.Status

    The status of the node.

    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

    Returns
    Type Description
    Node.Status

    Returns the status of the node started.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)