# Task Node

### Description

Task Node is base abstract class for all task nodes.

To create a custom task node you should inherit from Task Node class and implement logic that is described below.

### OnUpdate

When inheriting from Task Node you have to override OnUpdate method.

<pre class="language-csharp"><code class="lang-csharp">public class ExampleTaskNode : TaskNode
{
    protected override State OnUpdate() 
    { 
        throw new System.NotImplementedException();
    }
<strong>}
</strong></code></pre>

* OnUpdate gets called every tick during node execution according to [Behaviour Tree](https://renownedgames.gitbook.io/ai-tree/basic/behaviour-tree)  Update Mode.
* OnUpdate returns state of the node after update.

### OnEnter and OnExit

You can also override OnEntry and OnExit methods.

<pre class="language-csharp" data-full-width="false"><code class="lang-csharp">public class ExampleTaskNode : TaskNode
{
    protected override void OnEntry()
    {
        base.OnEntry();
    }
 
    protected override State OnUpdate() 
    { 
        throw new System.NotImplementedException();
    }
    
    protected override void OnExit()
    {
        base.OnExit();
    }
<strong>}
</strong></code></pre>

* OnEntry gets called when [Behaviour Tree](https://renownedgames.gitbook.io/ai-tree/basic/behaviour-tree)  enters the node.
* OnExit gets called when [Behaviour Tree](https://renownedgames.gitbook.io/ai-tree/basic/behaviour-tree)  exits the node.

{% hint style="info" %}
To create custom task nodes in editor you should add [Node Content](https://renownedgames.gitbook.io/ai-tree/api/runtime/nodecontentattribute) attribute to your custom task node class.
{% endhint %}
