Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ConvertToPrefabInstances(GameObject[], GameObject, ConvertToPrefabInstanceSettings, InteractionMode)

Convert an array of GameObjects to Prefab instances of the given Prefab Asset.
Read time 1 minuteLast updated 11 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule
public static void ConvertToPrefabInstances(GameObject[] plainGameObjects, GameObject prefabAssetRoot, ConvertToPrefabInstanceSettings settings, InteractionMode mode)

Parameters

plainGameObjects

The array of GameObjects that will be converted to Prefab instances.

prefabAssetRoot

The Prefab Asset used to create the Prefab instances from.

Settings to control the conversion.

Using UserAction will record undo and show dialogs if needed.

Remarks

This function is similar to the PrefabUtility.ConvertToPrefabInstance method, except it will perform the operation on each of the GameObjects in the input.