> For the complete documentation index, see [llms.txt](https://docs.gamecreator.one/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gamecreator.one/game-creator/systems/game-creator-api/custom-conditions.md).

# Custom Conditions

Creating custom **Conditions** is much like creating custom **Actions** but even easier. If you haven't taken a look at how to create **Actions** it is encourage that you do so, as the process is practically the same.

To create a custom **Condition** right-click in the *Project Panel*, select `Create → GameCreator → Condition` and give it a suitable name. Because the template file is a too simple **Condition** example, we're going to create a more complex one through this manual. We're going to create a \*\*Condition that checks whether two objects are within a certain radius.

{% hint style="success" %}
We use the convention **"Condition" +** **name**, but you can use whatever you like.
{% endhint %}

![](/files/-LB0V8Mh55rd4BIJiFxG)

A **Condition** code is divided in a *runtime* section and an *editor* section.

![](/files/-LB0VTzTpTGv65etIiCB)

The runtime section describes how it checks whether *something* is true or false. To do so, declare your properties below the class definition and override the `Check` method. To create the new **Condition** let's remove the `isSatisfied` property and create 3 others:

```csharp
public Transform objectA;
public Transform objectB;
public float maxDistance = 5.0f;
```

And finally fill the `Check()` method. To check whether `objectA` is within a distance of `maxDistance` respect `objectB` we calculate the distance between the two objects and return if the value is lower than the threshold.

```csharp
public override bool Check(GameObject target)
{
    if (this.objectA == null) return false;
    if (this.objectB == null) return false;
​
    float distance = Vector3.Distance(
        this.objectA.position,
        this.objectB.position
    );
​
    return (distance <= this.maxDistance);
}
```

{% hint style="info" %}
The *Editor* section of a **Condition** is exactly as the **Action**. Check it out clicking [here](/game-creator/systems/game-creator-api/custom-actions.md#editor-body-example).
{% endhint %}
