> For the complete documentation index, see [llms.txt](https://giantgrey.gitbook.io/databrain/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://giantgrey.gitbook.io/databrain/add-ons/logic/custom-nodes/asynchronous-execution.md).

# Asynchronous execution

Since it’s not possible to execute coroutines on scriptable objects, you can use async/await. See the following code examples:

<pre class="language-csharp"><code class="lang-csharp"><strong>// use this namespace
</strong><strong>using System.Threading.Tasks;
</strong>
[DataObjectDropdown(true, sceneComponentType: typeof(GameObject))]
public SceneComponent targetGameObject;
public float movementSpeed = 10;

public override void ExecuteNode()
{
     // start the async method
<strong>     Move();
</strong>}   

// Async method
async void Move()
{
     // Get the scene game object reference
     var _obj = targetGameObject.GetReference&#x3C;GameObject>(this);
     
     while (true)
     {
          // move the object
          _obj.transform.position += _obj.transform.forward * Time.deltaTime * movementSpeed;
          
          // similar to Unity's yield return null to wait for one frame            
          await Task.Yield();
     }  
}
</code></pre>

## Databrain.UnityAsync

Logic also implements the useful <mark style="background-color:orange;">UnityAsync</mark> system which implements some useful helpers.\
Use it by implementing the namespace:

{% hint style="info" %}
It is recommended that you use **Databrain.UnityAsync** to prevent some unexpected behaviour like code execution in the editor etc.
{% endhint %}

```csharp
using Databrain.UnityAsync
```

Then instead of using:

```csharp
await Task.Yield();
```

like in the code example above, you can use:

```csharp
await Await.NextUpdate();
```

or if you want to wait for some seconds:

```csharp
await Await.Seconds(3);
```
