# Nodes

### Namespace

```csharp
using FlowReactor.Nodes
```

### Init

```csharp
public virtual void Init(Graph _graph, Node _node)
```

Called when node is created in a graph

### OnExecute

```csharp
public virtual void OnExecute(FlowReactorComponent _flowReactor){}
```

Called when node is being executed. This is where your custom code belongs to when creating custom nodes.

| Parameters           | Description                                                             |
| -------------------- | ----------------------------------------------------------------------- |
| FlowReactorComponent | The actual FlowReactor component which executes this graph in the scene |

### ExecuteNext

```csharp
public void ExecuteNext(Enum _outputEnum, FlowReactorComponent _flowReactor)
public void ExecuteNext(int _output, FlowReactorComponent _flowReactor)
```

&#x20;Execute the next node which is connected on the nodes output port.

| Parameters                             | Description                                         |
| -------------------------------------- | --------------------------------------------------- |
| Enum **\_outpuEnum**                   | Pass the output port as an enum (see example below) |
| int **\_output**                       | The output port index                               |
| FlowReactorComponent **\_flowReactor** | The current FlowReactor component                   |

**Example**

```csharp
// Execute the next connected node with custom enum.
// Create custom enum
enum CustomOutputs
{
  OutputA = 0,
  OutputB = 1
}
// Execute next node with custom enum			
ExecuteNext(CustomOutputs.OutputA, _flowreactor);
```

### OnNodeDisable

```csharp
public virtual void OnNodeDisable(FlowReactorComponent _flowReactor){}
```

Called by FlowReactorComponent OnDisable

### OnInitialize

```csharp
public virtual void OnInitialize(FlowReactorComponent _flowReactor)
```

Similar to the Monobehaviour Awake. Gets called on initialization on every node in all graphs and subgraphs. No matter if the sub-graph is currently active or not

### OnGraphStart

```csharp
public virtual void OnGraphStart(FlowReactorComponent _flowReactor)
```

OnGraphStart should be only used by the OnStart node. Unlike the OnInitialization, OnStart only gets called in the root graph and only if the graph is active.

### OnUpdate

```csharp
public virtual void OnUpdate(FlowReactorComponent _flowReactor)
```

Similar to the Monobehaviour Update method. Gets called on every frame.

### OnLateUpdate

```csharp
public virtual void OnLateUpdate(FlowReactorComponent _flowReactor)
```

Similar to the Monobehaviour LateUpdate method.

### OnFixedUpdate

```csharp
public virtual void OnFixedUpdate(FlowReactorComponent _flowReactor)
```

Similar to the Monobehaviour FixedUpdate method.

### OnApplicationExit

```csharp
public virtual void OnApplicationExit(FlowReactorComponent _flowReactor)
```

Gets called on application quit

### OnSelect

```csharp
public virtual void OnSelect(Graph _graph)
```

Editor method which gets called when the node has been selected.

### OnDelete

```csharp
public virtual void OnDelete()
```

Editor method. Gets called when node gets deleted

### DrawCustomInspector

```csharp
public virtual void DrawCustomInspector()
```

Override this method to create custom node inspector GUIs

### DrawGUI

```csharp
public virtual void DrawGUI(string _title, int _id, Graph _graph, GUISkin _editorSkin)
```

Draws the default node GUI. Override this method to add custom GUI Elements


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://giantgrey.gitbook.io/flowreactor/api/nodes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
