# UnpackPrefabInstanceAndReturnNewOutermostRoots(GameObject, PrefabUnpackMode)

> Unpacks the given Prefab instance using the behaviour specified by unpackMode.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.6/script-reference/unityeditor.md)
* **Assembly:** UnityEditor.CoreModule

```csharp
public static GameObject[] UnpackPrefabInstanceAndReturnNewOutermostRoots(GameObject instanceRoot, PrefabUnpackMode unpackMode)
```

### Parameters

**** (\[GameObject]\(/engine/6000.6/script-reference/unityengine/gameobject)): Root GameObject of the Prefab instance.**** (\[PrefabUnpackMode]\(/engine/6000.6/script-reference/unityeditor/prefabunpackmode)): The unpack mode to use.

### Returns

| Type                                                                        | Description                                                           |
| --------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| [GameObject\[\]](/engine/6000.6/script-reference/unityengine/gameobject.md) | Array of GameObjects representing roots of unpacked Prefab instances. |

### Remarks

If the PrefabUnpackMode is the PrefabUnpackMode.OutermostRoot this function will return any new Prefab root GameObjects from any nested Prefabs at the first level.

Unlike [PrefabUtility.UnpackPrefabInstance](/engine/6000.6/script-reference/unityeditor/prefabutility/unpackprefabinstance.md), this function can’t be made undoable. You will have to handle undo yourself.

See [PrefabUtility.UnpackPrefabInstance](/engine/6000.6/script-reference/unityeditor/prefabutility/unpackprefabinstance.md) for a full description of the unpacking behaviour.
