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

# Class sfGuidManager

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

Manages generation of guids for game objects, and stores a mapping between game objects and guids. The guids are persistent ids that uniquely identify game objects.

```csharp
public class sfGuidManager
```

#### Inheritance

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

## Methods

### Clear() <a href="#ks_scenefusion_client_unity_editor_sfguidmanager_clear" id="ks_scenefusion_client_unity_editor_sfguidmanager_clear"></a>

Clears the mapping between guids and objects.

```csharp
public void Clear()
```

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

```csharp
public static sfGuidManager Get()
```

#### Returns

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

singleton instance

### GetGameObject(Guid) <a href="#ks_scenefusion_client_unity_editor_sfguidmanager_getgameobject_system_guid" id="ks_scenefusion_client_unity_editor_sfguidmanager_getgameobject_system_guid"></a>

Gets a game object by its guid.

```csharp
public GameObject GetGameObject(Guid guid)
```

#### Parameters

`guid` Guid

guid to get game object for.

#### Returns

GameObject

for the guid, or null if none is found.

### GetGuid(GameObject, bool) <a href="#ks_scenefusion_client_unity_editor_sfguidmanager_getguid_unityengine_gameobject_system_boolean" id="ks_scenefusion_client_unity_editor_sfguidmanager_getguid_unityengine_gameobject_system_boolean"></a>

Gets the guid for a game object. Assigns a guid if one does not already exist. There are two strategies for assigning a guid:

1. Create a deterministic guid by hashing the game object's scene, name, parent guid, and transform. This allows multiple users starting with the same scene to generate the same guids.
2. Use System.Guid to create a guid.

```csharp
public Guid GetGuid(GameObject gameObject, bool deterministic = false)
```

#### Parameters

`gameObject` GameObject

gameObject to get or create guid for.

`deterministic` bool

determines if we should use the deterministic guid or system.guid to create a guid if the game object does not already have one.

#### Returns

Guid

for the game object.

### LoadGuids(Scene) <a href="#ks_scenefusion_client_unity_editor_sfguidmanager_loadguids_unityengine_scenemanagement_scene" id="ks_scenefusion_client_unity_editor_sfguidmanager_loadguids_unityengine_scenemanagement_scene"></a>

Load guids for a scene from its sfGuidList.

```csharp
public void LoadGuids(Scene scene)
```

#### Parameters

`scene` Scene

scene to load guids from.

### RegisterEventListeners() <a href="#ks_scenefusion_client_unity_editor_sfguidmanager_registereventlisteners" id="ks_scenefusion_client_unity_editor_sfguidmanager_registereventlisteners"></a>

Registers event listeners

```csharp
public void RegisterEventListeners()
```

### Remove(GameObject) <a href="#ks_scenefusion_client_unity_editor_sfguidmanager_remove_unityengine_gameobject" id="ks_scenefusion_client_unity_editor_sfguidmanager_remove_unityengine_gameobject"></a>

Removes a game object and its guid from the map.

```csharp
public void Remove(GameObject gameObject)
```

#### Parameters

`gameObject` GameObject

### SaveGuids() <a href="#ks_scenefusion_client_unity_editor_sfguidmanager_saveguids" id="ks_scenefusion_client_unity_editor_sfguidmanager_saveguids"></a>

Saves guids into the sfGuidList for each scene.

```csharp
public void SaveGuids()
```

### SetGuid(GameObject, Guid) <a href="#ks_scenefusion_client_unity_editor_sfguidmanager_setguid_unityengine_gameobject_system_guid" id="ks_scenefusion_client_unity_editor_sfguidmanager_setguid_unityengine_gameobject_system_guid"></a>

Sets the guid for a game object.

```csharp
public void SetGuid(GameObject gameObject, Guid guid)
```

#### Parameters

`gameObject` GameObject

gameObject to set guid for.

`guid` Guid

guid to set.
