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

# Class sfPrefabPreviewScene

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

Loads a copy of a prefab into a preview scene which allows you to perform edits on the copy that aren't allowed directly on the prefab such as reparenting or unpacking prefab variants, and then save the changes back to the prefab.

```csharp
public class sfPrefabPreviewScene
```

#### Inheritance

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

## Constructors

### sfPrefabPreviewScene(GameObject) <a href="#ks_scenefusion_client_unity_editor_sfprefabpreviewscene__ctor_unityengine_gameobject" id="ks_scenefusion_client_unity_editor_sfprefabpreviewscene__ctor_unityengine_gameobject"></a>

Constructor

```csharp
public sfPrefabPreviewScene(GameObject prefab)
```

#### Parameters

`prefab` GameObject

Prefab to load into a preview scene. If this is not a prefab, the preview scene won't be loaded.

### sfPrefabPreviewScene(string) <a href="#ks_scenefusion_client_unity_editor_sfprefabpreviewscene__ctor_system_string" id="ks_scenefusion_client_unity_editor_sfprefabpreviewscene__ctor_system_string"></a>

Constructor

```csharp
public sfPrefabPreviewScene(string path)
```

#### Parameters

`path` string

Path to prefab to load into a preview scene. If the prefab isn't found, the preview scene won't be loaded.

## Properties

### PrefabPath <a href="#ks_scenefusion_client_unity_editor_sfprefabpreviewscene_prefabpath" id="ks_scenefusion_client_unity_editor_sfprefabpreviewscene_prefabpath"></a>

Path to the prefab asset.

```csharp
public string PrefabPath { get; }
```

#### Property Value

string

### RootObject <a href="#ks_scenefusion_client_unity_editor_sfprefabpreviewscene_rootobject" id="ks_scenefusion_client_unity_editor_sfprefabpreviewscene_rootobject"></a>

The root object in the preview scene that is a copy of the prefab asset root.

```csharp
public GameObject RootObject { get; }
```

#### Property Value

GameObject

### Scene <a href="#ks_scenefusion_client_unity_editor_sfprefabpreviewscene_scene" id="ks_scenefusion_client_unity_editor_sfprefabpreviewscene_scene"></a>

The preview scene.

```csharp
public Scene Scene { get; }
```

#### Property Value

Scene

## Methods

### Close() <a href="#ks_scenefusion_client_unity_editor_sfprefabpreviewscene_close" id="ks_scenefusion_client_unity_editor_sfprefabpreviewscene_close"></a>

Closes the preview scene.

```csharp
public void Close()
```

### FindEquivalentGameObject(GameObject) <a href="#ks_scenefusion_client_unity_editor_sfprefabpreviewscene_findequivalentgameobject_unityengine_gameobj" id="ks_scenefusion_client_unity_editor_sfprefabpreviewscene_findequivalentgameobject_unityengine_gameobj"></a>

Finds the game object at the equivalent hierarchy location to `target` under the [RootObject](#ks_scenefusion_client_unity_editor_sfprefabpreviewscene_rootobject). Eg. if `transform` is the first child of the second child of a root object, gets the first child of the second child of root object.

```csharp
public GameObject FindEquivalentGameObject(GameObject target)
```

#### Parameters

`target` GameObject

Game object to find equivalent game object for.

#### Returns

GameObject

Game object located at the equivalent hierarchy location under the root as `target`, or null if none was found.

### FindEquivalentTransform(Transform) <a href="#ks_scenefusion_client_unity_editor_sfprefabpreviewscene_findequivalenttransform_unityengine_transfor" id="ks_scenefusion_client_unity_editor_sfprefabpreviewscene_findequivalenttransform_unityengine_transfor"></a>

Finds the transform at the equivalent hierarchy location to `targetTransform` under the [RootObject](#ks_scenefusion_client_unity_editor_sfprefabpreviewscene_rootobject)'s transform. Eg. if `targetTransform` is the first child of the second child of a root object, gets the first child of the second child of root object's transform.

```csharp
public Transform FindEquivalentTransform(Transform targetTransform)
```

#### Parameters

`targetTransform` Transform

Transform to find equivalent transform for.

#### Returns

Transform

Transform located at the equivalent hierarchy location under the root transform as `targetTransform`, or null if none was found.

### Save() <a href="#ks_scenefusion_client_unity_editor_sfprefabpreviewscene_save" id="ks_scenefusion_client_unity_editor_sfprefabpreviewscene_save"></a>

Saves the contents of the preview scene to the prefab.

```csharp
public void Save()
```
