Description

This is the custom graph class that represents a ReturnGraph in the editor. This class contains the core logic for displaying a graph in the editor, as well as logic for validating the nodes of a ReturnGraph. This class exists only in the editor and is converted to a RuntimeReturnGraph when imported for runtime.

ReturnGraph is marked with 2 required attributes:

Static Properties

Property Description
ASSET_EXTENSION Constant string for the file extension of a ReturnGraph asset
INPUT_PORT_DEFAULT_NAME Constant string for the name of any Input port that requires a variable input
EXECUTION_PORT_DEFAULT_NAME Constant string for the name of any Input or Output port connecting an ‣ to another node

Static Methods

Method Access Description
CreateAssetFile private Creates a new ReturnGraph asset. Accessible via the “Create > ReturnGraph” context menu or “Tools > ReturnGraph” menu via a “MenuItem” attribute.

Methods

Method Access Description
OnGraphChanged public Event called whenever a change occurs on the graph. Handles changes made to the graph and validates its structure and configuration.
ValidateInputPorts private Validates the input ports of all nodes in the graph and logs a warning for each disconnected port. Also logs a warning for any input port with the phrase “Input” in its name that is not connected to a variable node.
ValidateOutputPorts private Validates the output ports of all nodes in the graph and logs a warning for each output port that is not connected to another node.
ValidateReturnNodes private Validates the return nodes in the graph and logs a warning for each ‣ that does not have a return value.
ValidateConditionNodes private Validates the condition nodes in the graph and logs a warning for each ‣ that does not have a ‣ value.
ValidateRandomNodes private Validates the random nodes in the graph and logs a warning for each ‣ that has less than 2 output ports.
ValidateSwitchNodes private Validates the switch nodes within the graph and logs a warning for each ‣ missing an ‣ value.
ValidateStartNodes private Validates the start nodes in the graph and logs an error if no ‣ is found and warnings if multiple start nodes are present.
CheckForDuplicateVariableNames private Checks for duplicate variable names within the graph and logs an error for each duplicate found.