Version: 2018.3b (switch to 2018.2 or 2017.4)
LanguageEnglish
  • C#
Method group is Obsolete

PrefabUtility.FindPrefabRoot

Suggest a change

Success!

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.

Close

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.

Close

Cancel

Obsolete public static GameObject FindPrefabRoot(GameObject source);

Parameters

sourceThe object to check.

Returns

GameObject The Prefab root.

Description

Returns the root GameObject of the Prefab that the supplied GameObject is part of.

This checks if the object is part of a Prefab (either a Prefab instance or a Prefab Asset). If so it returns the root GameObject of the Prefab.

This method is used internally in the Editor to help the user select the correct object when GameObjects are clicked in the Scene view.

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