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

# Class sfFileIdUpdater

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

Overwrites Unity local file ids in a file. Can only be used when serialization mode is ForceText.

```csharp
public class sfFileIdUpdater
```

#### Inheritance

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

## Methods

### Get(Object, bool) <a href="#ks_scenefusion_client_unity_editor_sffileidupdater_get_unityengine_object_system_boolean" id="ks_scenefusion_client_unity_editor_sffileidupdater_get_unityengine_object_system_boolean"></a>

Gets the file id updater for an asset, optionally creating one if it does not exist.

```csharp
public static sfFileIdUpdater Get(Object asset, bool create = true)
```

#### Parameters

`asset` Object

Asset to get file id updater for.

`create` bool

True to create an updater for the asset if one does not exist. Will not create if `asset` is not an asset.

#### Returns

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

File id updater for the asset, or null if none was found.

### SetFileId(Object, long, ReplaceHandler) <a href="#ks_scenefusion_client_unity_editor_sffileidupdater_setfileid_unityengine_object_system_int64_ks_scen" id="ks_scenefusion_client_unity_editor_sffileidupdater_setfileid_unityengine_object_system_int64_ks_scen"></a>

Sets the local file id for a uobject in the asset. The file id isn't applied until [UpdateFileIds](#ks_scenefusion_client_unity_editor_sffileidupdater_updatefileids) is called.

```csharp
public void SetFileId(Object uobj, long newFileId, sfFileIdUpdater.ReplaceHandler replaceHandler = null)
```

#### Parameters

`uobj` Object

UObject to set file id for.

`newFileId` long

File id to set.

`replaceHandler` [sfFileIdUpdater](/scene-fusion/api-reference/ks.scenefusion.client.unity.editor/ks.scenefusion.client.unity.editor.sffileidupdater.md).[ReplaceHandler](/scene-fusion/api-reference/ks.scenefusion.client.unity.editor/ks.scenefusion.client.unity.editor.sffileidupdater/ks.scenefusion.client.unity.editor.sffileidupdater.replacehandler.md)

Callback to call when the uobject is replaced after the file ids are updated. If null, [OnReplace](/scene-fusion/api-reference/ks.scenefusion.client.unity.editor/ks.scenefusion.client.unity.editor.sfbaseuobjecttranslator.md#ks_scenefusion_client_unity_editor_sfbaseuobjecttranslator_onreplace_ks_scenefusion_client_sfobject). Use this to get a callback for unsynced uobjects.

### UpdateFileIds() <a href="#ks_scenefusion_client_unity_editor_sffileidupdater_updatefileids" id="ks_scenefusion_client_unity_editor_sffileidupdater_updatefileids"></a>

Updates local file ids set by SetFileId(UObject, long) by overwriting the old ids in the asset file and clears the updater. Changing an assets file id will destroy the old uobject instance of that asset and create a new one. Calls the old uobject's replace handler if there is one, or calls [OnReplace](/scene-fusion/api-reference/ks.scenefusion.client.unity.editor/ks.scenefusion.client.unity.editor.sfbaseuobjecttranslator.md#ks_scenefusion_client_unity_editor_sfbaseuobjecttranslator_onreplace_ks_scenefusion_client_sfobject) to inform translators of the replacements. Once this is called, [Get](#ks_scenefusion_client_unity_editor_sffileidupdater_get_unityengine_object_system_boolean) will return null or optionally create a new instance.

```csharp
public void UpdateFileIds()
```
