# Editor.EditorUtility.Prefabs.ConvertGameObjectToPrefab

```csharp
static GameObject ConvertGameObjectToPrefab(GameObject go, string saveLocation, bool skipDiskWrite = False)
```

Convert a GameObject to a prefab. This will write the newly created prefab to disk and set the prefab source on the GameObject.
Returns the converted GameObject, which may be a clone of the original if it was part of a prefab instance, or null on failure.

### Parameters

- `go` (`GameObject`)
- `saveLocation` (`string`)
- `skipDiskWrite` (`bool`), default `False`

### Returns

`GameObject`

Declared in [Editor.EditorUtility.Prefabs](/api/Editor.EditorUtility.Prefabs).
Assembly: `Sandbox.Tools`.
