> For the complete documentation index, see [llms.txt](https://renownedgames.gitbook.io/ai-tree/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://renownedgames.gitbook.io/ai-tree/api/runtime/observer-decorator.md).

# Observer Decorator

Type description and basic instructions.

### Description

Observer Decorator is base abstract class for all decorator nodes that are supposed to continiously observe certain key values.

To create a custom observer decorator you should inherit from Observer Decorator class and implement logic that is described below.

### CalculateResult and OnValueChange

When inheriting from Observer Decorator you have to override CalculateResult method and OnValueChange event.

```csharp
public class ExampleObserverDecorator : ObserverDecorator
{
    public override bool CalculateResult()
    {
        throw new NotImplementedException();
    }

    public override event Action OnValueChange;
}
```

* Calculate result calculates the observed value of the result.
* CalculateResult gets called every tick during node execution.
* OnValueChanged gets called when the observed key value changes.

{% hint style="info" %}
Observer Decorator inherits from [Decorator Node](/ai-tree/api/runtime/decorator-node.md)
{% endhint %}

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