CreatePrefab
Creates a Prefab from a game object hierarchy.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEditor
- Assembly: UnityEditor.CoreModule
CreatePrefab(string, GameObject)
Creates a Prefab from a game object hierarchy.
public static GameObject CreatePrefab(string path, GameObject go)
Parameters
The path where the Prefab is saved.
The GameObject that you want to create a Prefab from.
Returns
Type | Description |
|---|---|
| GameObject | A reference to the created Prefab. |
Remarks
Use this to create a Prefab from a GameObject in the hierarchy, and give it a path to save the Prefab in.
CreatePrefab(string, GameObject, ReplacePrefabOptions)
Creates a Prefab from a game object hierarchy.
public static GameObject CreatePrefab(string path, GameObject go, ReplacePrefabOptions options)
Parameters
The path where the Prefab is saved.
The GameObject that you want to create a Prefab from.
Returns
Type | Description |
|---|---|
| GameObject | A reference to the created Prefab. |
Remarks
Use this to create a Prefab from a GameObject in the hierarchy, and give it a path to save the Prefab in.