> For the complete documentation index, see [llms.txt](https://kinematicsoup.gitbook.io/scene-fusion/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kinematicsoup.gitbook.io/scene-fusion/api-reference/ks.scenefusion.client.unity.editor/ks.scenefusion.client.unity.editor.sfundomanager.md).

# Class sfUndoManager

Namespace: [KS.SceneFusion.Client.Unity.Editor](/scene-fusion/api-reference/ks.scenefusion.client.unity.editor.md)\
Assembly: KSUnity-Source.dll

Handles syncing of undo/redo operations. Maintains undo and redo stacks that can sync the changes made by each undo operation. Changes made through Unity's serialized property system are automatically detected and recorded on the stack. Other changes must be recorded when detected by translators by calling Record() with a sfBaseUndoOperation.

```csharp
public class sfUndoManager
```

#### Inheritance

object ← [sfUndoManager](/scene-fusion/api-reference/ks.scenefusion.client.unity.editor/ks.scenefusion.client.unity.editor.sfundomanager.md)

## Properties

### HasPendingPropertyModifications <a href="#ks_scenefusion_client_unity_editor_sfundomanager_haspendingpropertymodifications" id="ks_scenefusion_client_unity_editor_sfundomanager_haspendingpropertymodifications"></a>

True if there are pending property modifications to be added to the latest transaction, or if there is an active transaction (being undone or redone) with property modifications.

```csharp
public bool HasPendingPropertyModifications { get; }
```

#### Property Value

bool

### IsHandlingUndoRedo <a href="#ks_scenefusion_client_unity_editor_sfundomanager_ishandlingundoredo" id="ks_scenefusion_client_unity_editor_sfundomanager_ishandlingundoredo"></a>

Are we syncing changes made by an undo/redo operation?

```csharp
public bool IsHandlingUndoRedo { get; }
```

#### Property Value

bool

### PendingPropertyModifications <a href="#ks_scenefusion_client_unity_editor_sfundomanager_pendingpropertymodifications" id="ks_scenefusion_client_unity_editor_sfundomanager_pendingpropertymodifications"></a>

The pending property modifications to be added to the latest transaction, or if there is an active transaction (being undone or redone), the property modifications from that transaction.

```csharp
public UndoPropertyModification[] PendingPropertyModifications { get; }
```

#### Property Value

UndoPropertyModification\[]

### UndoNextOperation <a href="#ks_scenefusion_client_unity_editor_sfundomanager_undonextoperation" id="ks_scenefusion_client_unity_editor_sfundomanager_undonextoperation"></a>

If true, the next operation to be registered on the undo stack will be undone.

```csharp
public bool UndoNextOperation { get; set; }
```

#### Property Value

bool

## Methods

### AddModifications(UndoPropertyModification\[], UndoPropertyModification\[]) <a href="#ks_scenefusion_client_unity_editor_sfundomanager_addmodifications_unityeditor_undopropertymodificati" id="ks_scenefusion_client_unity_editor_sfundomanager_addmodifications_unityeditor_undopropertymodificati"></a>

Adds an array of new modifications to an existing array of modifications, updating the value for the existing modification if it already exists and appending it if it does not.

```csharp
public UndoPropertyModification[] AddModifications(UndoPropertyModification[] currentModifications, UndoPropertyModification[] newModifications)
```

#### Parameters

`currentModifications` UndoPropertyModification\[]

currentModifications to update.

`newModifications` UndoPropertyModification\[]

newModifications to add.

#### Returns

UndoPropertyModification\[]

combined modifications.

### ClearRedo() <a href="#ks_scenefusion_client_unity_editor_sfundomanager_clearredo" id="ks_scenefusion_client_unity_editor_sfundomanager_clearredo"></a>

Clears the redo stack.

```csharp
public void ClearRedo()
```

### Get() <a href="#ks_scenefusion_client_unity_editor_sfundomanager_get" id="ks_scenefusion_client_unity_editor_sfundomanager_get"></a>

```csharp
public static sfUndoManager Get()
```

#### Returns

[sfUndoManager](/scene-fusion/api-reference/ks.scenefusion.client.unity.editor/ks.scenefusion.client.unity.editor.sfundomanager.md)

singleton instance.

### Record(sfBaseUndoOperation) <a href="#ks_scenefusion_client_unity_editor_sfundomanager_record_ks_scenefusion_client_unity_editor_sfbaseund" id="ks_scenefusion_client_unity_editor_sfundomanager_record_ks_scenefusion_client_unity_editor_sfbaseund"></a>

Records an operation on the undo stack. If we are currently handling an undo/redo, the operation will not be recorded.

```csharp
public void Record(sfBaseUndoOperation operation)
```

#### Parameters

`operation` [sfBaseUndoOperation](/scene-fusion/api-reference/ks.scenefusion.client.unity.editor/ks.scenefusion.client.unity.editor.sfbaseundooperation.md)

### Start() <a href="#ks_scenefusion_client_unity_editor_sfundomanager_start" id="ks_scenefusion_client_unity_editor_sfundomanager_start"></a>

Starts monitoring undo operations.

```csharp
public void Start()
```

### Stop() <a href="#ks_scenefusion_client_unity_editor_sfundomanager_stop" id="ks_scenefusion_client_unity_editor_sfundomanager_stop"></a>

Stops monitoring undo operations.

```csharp
public void Stop()
```

### OnRegisterUndo <a href="#ks_scenefusion_client_unity_editor_sfundomanager_onregisterundo" id="ks_scenefusion_client_unity_editor_sfundomanager_onregisterundo"></a>

Invoked when an operation is registered on Unity's undo stack.

```csharp
public event sfUndoManager.RegisterUndoHandler OnRegisterUndo
```

#### Event Type

[sfUndoManager](/scene-fusion/api-reference/ks.scenefusion.client.unity.editor/ks.scenefusion.client.unity.editor.sfundomanager.md).[RegisterUndoHandler](/scene-fusion/api-reference/ks.scenefusion.client.unity.editor/ks.scenefusion.client.unity.editor.sfundomanager/ks.scenefusion.client.unity.editor.sfundomanager.registerundohandler.md)
