> 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.sfobjectutils.md).

# Class sfObjectUtils

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

sfObject utility functions.

```csharp
public static class sfObjectUtils
```

#### Inheritance

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

## Methods

### DeleteAndReplaceReferences(sfObject, sfObject) <a href="#ks_scenefusion_client_unity_editor_sfobjectutils_deleteandreplacereferences_ks_scenefusion_client_sf" id="ks_scenefusion_client_unity_editor_sfobjectutils_deleteandreplacereferences_ks_scenefusion_client_sf"></a>

Deletes `obj` and updates references to it to instead reference `replacementObj`. If session edits are disabled because SF is proccessing RPCs, does the deletion and reference updating in delayCall.

```csharp
public static void DeleteAndReplaceReferences(sfObject obj, sfObject replacementObj)
```

#### Parameters

`obj` [sfObject](/scene-fusion/api-reference/ks.scenefusion.client/ks.scenefusion.client.sfobject.md)

Object to delete and replace references for.

`replacementObj` [sfObject](/scene-fusion/api-reference/ks.scenefusion.client/ks.scenefusion.client.sfobject.md)

Object references should refence instead of `obj`.

### DeleteDuplicate(sfObject, sfObject) <a href="#ks_scenefusion_client_unity_editor_sfobjectutils_deleteduplicate_ks_scenefusion_client_sfobject_ks_s" id="ks_scenefusion_client_unity_editor_sfobjectutils_deleteduplicate_ks_scenefusion_client_sfobject_ks_s"></a>

Deletes `newObj` if `currentObj` was already created on the server, otherwise deletes `newObj`. Updates references to the deleted object to instead reference the other object. This is used to delete the sfObject that was creates 2nd on the server when multiple sfObjects are created for the same uobject. The deletion/reference updating happens in delayCall if edits are disabled because SF is still processing RPCs.

```csharp
public static bool DeleteDuplicate(sfObject currentObj, sfObject newObj)
```

#### Parameters

`currentObj` [sfObject](/scene-fusion/api-reference/ks.scenefusion.client/ks.scenefusion.client.sfobject.md)

Current [sfObject](/scene-fusion/api-reference/ks.scenefusion.client/ks.scenefusion.client.sfobject.md) for the uobject.

`newObj` [sfObject](/scene-fusion/api-reference/ks.scenefusion.client/ks.scenefusion.client.sfobject.md)

New [sfObject](/scene-fusion/api-reference/ks.scenefusion.client/ks.scenefusion.client.sfobject.md) for the uobject.

#### Returns

bool

True if `newObj` was or will be deleted because `currentObj` was created first.
