Udonite compiles ordinary Unity C#, so porting an UdonSharp script is a mechanical rewrite, not a rewrite of logic. If you start from an unmodified UdonSharp file, the compiler recognises the four names that are left over and tells you the replacement instead of a bare "could not be found".

## The rewrite table

| UdonSharp | Udonite | Notes |
|---|---|---|
| `using UdonSharp;` | `using Udonite;` for the behaviour base class, `using Udonite.Net;` for `Synced<T>` | Two namespaces. |
| `class X : UdonSharpBehaviour` | `class X : UdoniteBehaviour` or `class X : MonoBehaviour` | Both compile the same. Unity and Udon events are recognised by name either way. |
| `[UdonSynced] T x;` | `Synced<T> x = new Synced<T>();` | A wrapper type, not an attribute. |
| `[UdonSynced(UdonSyncMode.Linear)] T x;` | `Synced<T>` | The sync mode is derived from how the fields are used. |
| `[FieldChangeCallback(nameof(OnXChanged))] T x;` | `x.Subscribe(OnXChanged)` | Subscribe once, usually in `Start`. |
| `[UdonBehaviourSyncMode(...)]` | Nothing to write | Derived, see below. |
| `VRCInstantiate(prefab)` | `Instantiate(prefab)` | Ordinary Unity API. |
| `SendCustomEventDelayedSeconds(name, seconds)` | `this.SendCustomEventDelayedSeconds(name, seconds)` | An extension method; needs `using Udonite;`. |

## Synced fields

Declare a `Synced<T>` instead of tagging a plain field:

```csharp
using Udonite.Net;
using UnityEngine;

public class Scoreboard : MonoBehaviour
{
    private Synced<int> score = new Synced<int>();

    void Start()
    {
        score.Value = 7;
        int current = score.Value;
    }
}
```

Writing `.Value` also requests serialization, so there is no separate `RequestSerialization()` call to forget. Arrays and every primitive, `string` and Unity value type Udon can replicate work the same way. A type Udon cannot replicate, such as a `GameObject` reference, is refused at the declaration and the diagnostic names the type.

A `Synced<T>` belongs on the behaviour itself, not on a plain class it reaches, and not as a static field.

## Reacting to a change

`Subscribe` is what `[FieldChangeCallback]` was, and a little more:

```csharp
void Start()
{
    score.Subscribe(OnScoreChanged);
    OnScoreChanged(score.Value);
}

void OnScoreChanged(int newValue)
{
}
```

The handler runs for the owner's own write and for a value that arrives over the network, the same handler both times. Nothing runs at the moment you subscribe, so call the handler once yourself with the current value, as above, which is also what a late joiner needs. `Subscribe(Action<T, T>)` hands the handler the old value as well.

A network update is applied one variable at a time, but subscribers are told once the whole update has landed, so a handler can read any other synced field on the behaviour and see the value that arrived with it. The owner's own writes notify inline, in order. If you want one place that always sees settled state, `OnDeserialization` runs after the whole batch.

## Sync mode

There is nothing to declare. A behaviour with at least one `Synced<T>` field is Manual. A behaviour with none has no opinion, so it never forces a mode onto the other behaviours on the same GameObject. An array-typed `Synced<T[]>`, which Continuous sync cannot carry at all, just works.

## What stays refused

`catch`. Udon has no exceptions to catch: a fault halts the behaviour, so a `catch` block could never run. Remove it and test the condition beforehand. `try` with `finally` and no `catch` is supported.

Mutable statics and `Awake` compile. For everything else Udon cannot run, and what to write instead, see [Language support](/docs/compiler/language-support) and [Diagnostics](/docs/compiler/diagnostics).
