---
name: "disableSerialization"
type: command
status: ok
groups: ["Namespaces", "GUI Control"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/disableSerialization
revid: 369064
updated: 2024-09-02T20:24:56Z
---

# disableSerialization

*Command · Namespaces, GUI Control · Arma 3 v0.50 · introduced in Arma 2 v1.00*

## Description

Disable saving of script containing this command. After this, the script can work with data types which do not support serialization (UI types).

> [!NOTE]
> See [Namespace serialization](../topics/Namespace.md#namespace-serialization) for more information.

> [!IMPORTANT]
> **In Arma 2** and up to a certain version of Arma 3, giving a [Display](../topics/Display.md) or [Control](../topics/Control.md) to [spawn](../commands/spawn.md)ed code would raise an error due to the usage of the then non-serializable `_this` variable. Using [disableSerialization](../commands/disableSerialization.md) or [uiNamespace](../commands/uiNamespace.md) wouldn't help; the trick here is to pass the argument inside an array:
>
> ```sqf
> _display = findDisplay 46;
>  _display  spawn { hint str _this; };                // would raise a serialization error
> [_display] spawn { hint str (_this select 0); };    // OK
> ```

## Syntax

```sqf
disableSerialization
```

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

```sqf
disableSerialization;
private _display = findDisplay 46;
```

## See also

[Display](../topics/Display.md) · [displayAddEventHandler](../commands/displayAddEventHandler.md) · [displayRemoveAllEventHandlers](../commands/displayRemoveAllEventHandlers.md) · [displayRemoveEventHandler](../commands/displayRemoveEventHandler.md) · [uiSleep](../commands/uiSleep.md)

## Community notes

**Str** — 2010-06-19

Can be used to detecting load. Scope with disabled serialization is discontinued after load, even if there's endless loop inside.

```sqf
0 spawn { disableSerialization; waitUntil { false }; hint "Game was loaded!";};
```

Works for all possible load types - loading user save, loading autosave and resuming mission from main menu.

Use with caution, as it creates an infinite loop, having impact at overall [scripting time](../topics/Code_Optimisation.md#threads).

---

**Killzone_Kid** — 2013-10-23

If you do not store UI elements ([Display](../topics/Display.md), [Control](../topics/Control.md)) in variables, you do not need [disableSerialization](../commands/disableSerialization.md); UI elements are usually returned by scripting commands such as [findDisplay](../commands/findDisplay.md) or passed as params in UI event handler scripts ([displayAddEventHandler](../commands/displayAddEventHandler.md), [ctrlAddEventHandler](../commands/ctrlAddEventHandler.md)).

This code will require [disableSerialization](../commands/disableSerialization.md):

```sqf
disableSerialization;
_display = findDisplay 123;
_ctrl = _display displayCtrl -1;
_ctrl ctrlSetText "LOL";
```

This code will not:

```sqf
findDisplay 123 displayCtrl -1 ctrlSetText "LOL";
```

---

**Nelis75733126** — 2017-06-25

In Arma 3 1.74, a scripted FSM is somehow incompatible with `disableSerialization`.

As a workaround, store a display inside an array. Example:

```sqf
_display = [findDisplay idd];
```

<sub>Source: [BI Community Wiki — disableSerialization](https://community.bistudio.com/wiki/disableSerialization) (revision 369064).</sub>
