ドキュメント

Unity Engine

Unity Engine

CreatePrefab

Creates a Prefab from a game object hierarchy.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule

CreatePrefab(string, GameObject)

Creates a Prefab from a game object hierarchy.
注意
Deprecated. Use SaveAsPrefabAsset instead.
public static GameObject CreatePrefab(string path, GameObject go)

Parameters

path

The path where the Prefab is saved.

The GameObject that you want to create a Prefab from.

Returns

Type

Description

GameObjectA 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.
注意
Deprecated. Use SaveAsPrefabAsset or SaveAsPrefabAssetAndConnect instead.
public static GameObject CreatePrefab(string path, GameObject go, ReplacePrefabOptions options)

Parameters

path

The path where the Prefab is saved.

The GameObject that you want to create a Prefab from.

Returns

Type

Description

GameObjectA 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.