Version: 2018.3 (switch to 2019.1)
  • C#


Suggest a change


Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.


Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.



public static void LoadPrefabContentsIntoPreviewScene(string prefabPath, SceneManagement.Scene scene);


sceneThe Scene to load the contents into.
prefabPathThe path of the Prefab Asset to load the contents of.


Loads a Prefab Asset at a given path into a given preview Scene and returns the root GameObject of the Prefab.

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 SaveAsPrefabAsset and then call UnloadPrefabContents to release the Prefab and isolated Scene from memory.

Did you find this page useful? Please give it a rating: