> For the complete documentation index, see [llms.txt](https://pahutyakv.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pahutyakv.gitbook.io/docs/delayed/define-based-actions.md).

# Define-Based Actions

The `Delayed.Define` module executes actions immediately, but only if certain environment, platform, orientation, or build conditions are met.

***

### <mark style="color:$success;">OS Methods</mark>

<details>

<summary><strong>OnAndroid(Action callback)</strong></summary>

Executes the `callback` if the application is running on Android.

{% code overflow="wrap" %}

```csharp
Delayed.Define.OnAndroid(() => Debug.Log("Running on Android"));
```

{% endcode %}

</details>

<details>

<summary><strong>OniOS(Action callback)</strong></summary>

Executes the `callback` if the application is running on iOS.

{% code overflow="wrap" %}

```csharp
Delayed.Define.OniOS(() => Debug.Log("Running on iOS"));
```

{% endcode %}

</details>

<details>

<summary><strong>OnWindows(Action callback)</strong></summary>

Executes the `callback` if the application is running on Windows Player.

{% code overflow="wrap" %}

```csharp
Delayed.Define.OnWindows(() => Debug.Log("Running on Windows"));
```

{% endcode %}

</details>

<details>

<summary><strong>OnMac(Action callback)</strong></summary>

Executes the `callback` if the application is running on macOS Player.

{% code overflow="wrap" %}

```csharp
Delayed.Define.OnMac(() => Debug.Log("Running on macOS"));
```

{% endcode %}

</details>

<details>

<summary><strong>OnLinux(Action callback)</strong></summary>

Executes the `callback` if the application is running on Linux Player.

{% code overflow="wrap" %}

```csharp
Delayed.Define.OnLinux(() => Debug.Log("Running on Linux"));
```

{% endcode %}

</details>

<details>

<summary><strong>OnWebGL(Action callback)</strong></summary>

Executes the `callback` if the application is running on WebGL.

{% code overflow="wrap" %}

```csharp
Delayed.Define.OnWebGL(() => Debug.Log("Running on WebGL"));
```

{% endcode %}

</details>

***

### <mark style="color:$success;">Device Methods</mark>

<details>

<summary><strong>OnMobile(Action callback)</strong></summary>

Executes the `callback` if the application is running on a mobile platform (Android or iOS).

{% code overflow="wrap" %}

```csharp
Delayed.Define.OnMobile(() => Debug.Log("Running on Mobile"));
```

{% endcode %}

</details>

<details>

<summary><strong>OnDesktop(Action callback)</strong></summary>

Executes the `callback` if the application is running on a desktop platform (Windows, macOS, Linux).

{% code overflow="wrap" %}

```csharp
Delayed.Define.OnDesktop(() => Debug.Log("Running on Desktop"));
```

{% endcode %}

</details>

<details>

<summary><strong>OnConsole(Action callback)</strong></summary>

Executes the `callback` immediately if the application is running on Console (PS4/PS5/XboxOne/GameCoreXboxSeries/Switch).

{% code overflow="wrap" %}

```csharp
Delayed.Define.OnDesktop(() => Debug.Log("Running on Desktop"));
```

{% endcode %}

</details>

***

### <mark style="color:$success;">Environment Methods</mark>

<details>

<summary><strong>OnRuntime(Action callback)</strong></summary>

Executes the `callback` if the application is running in runtime (not in the Editor).

{% code overflow="wrap" %}

```csharp
Delayed.Define.OnRuntime(() => Debug.Log("Runtime execution"));
```

{% endcode %}

</details>

<details>

<summary><strong>OnEditor(Action callback)</strong></summary>

Executes the `callback` if the application is running in the Unity Editor.

{% code overflow="wrap" %}

```csharp
Delayed.Define.OnEditor(() => Debug.Log("Editor execution"));
```

{% endcode %}

</details>

***

### <mark style="color:$success;">Screen Orientation Methods</mark>

<details>

<summary><strong>OnPortraitOrientation(Action callback)</strong></summary>

Executes the `callback` if the screen is in portrait orientation (including upside-down).

{% code overflow="wrap" %}

```csharp
Delayed.Define.OnPortraitOrientation(() => Debug.Log("Portrait mode"));
```

{% endcode %}

</details>

<details>

<summary><strong>OnLandscapeOrientation(Action callback)</strong></summary>

Executes the `callback` if the screen is in landscape orientation (left or right).

{% code overflow="wrap" %}

```csharp
Delayed.Define.OnLandscapeOrientation(() => Debug.Log("Landscape mode"));
```

{% endcode %}

</details>

***

### <mark style="color:$success;">Build Type Methods</mark>

<details>

<summary><strong>OnDevelopmentBuild(Action callback)</strong></summary>

Executes the `callback` if the current build is a development build.

{% code overflow="wrap" %}

```csharp
Delayed.Define.OnDevelopmentBuild(() => Debug.Log("Development build"));
```

{% endcode %}

</details>

<details>

<summary><strong>OnReleaseBuild(Action callback)</strong></summary>

Executes the `callback` if the current build is a release build.

{% code overflow="wrap" %}

```csharp
Delayed.Define.OnReleaseBuild(() => Debug.Log("Release build"));
```

{% endcode %}

</details>

***

### <mark style="color:$success;">Network Methods</mark>

<details>

<summary><strong>OnNetworkAvailable(Action callback)</strong></summary>

Executes the `callback` if the application has network connectivity.

{% code overflow="wrap" %}

```csharp
Delayed.Define.OnNetworkAvailable(() => Debug.Log("Network available"));
```

{% endcode %}

</details>

<details>

<summary><strong>OnNetworkNotAvailable(Action callback)</strong></summary>

Executes the `callback` if the application has no network connectivity.

{% code overflow="wrap" %}

```csharp
Delayed.Define.OnNetworkNotAvailable(() => Debug.Log("Network not available"));
```

{% endcode %}

</details>

***

### <mark style="color:$primary;">Notes</mark>

* Unlike typical conditional checks scattered in code, `Delayed.Define` provides **a declarative way** to execute actions only under specific contexts.
* Callbacks execute **immediately**, but only if the condition is true at runtime.
