LoadPrefabContentsIntoPreviewScene(string, Scene)
Loads a Prefab Asset at a given path into a given preview scene.
Read time 1 minuteLast updated 14 days ago
Definition
- Type: Method
- Namespace: UnityEditor
- Assembly: UnityEditor
public static void LoadPrefabContentsIntoPreviewScene(string prefabPath, Scene scene)
Parameters
Remarks
You can use this to get the content of the Prefab and modify it directly instead of going through an instance of the Prefab. This is useful for batch operations.
Once you have modified the Prefab you have to write it back using PrefabUtility.SaveAsPrefabAsset. After that you can either reuse your preview scene for other purposes, or close the preview scene with EditorSceneManager.CloseScene.