Version: Unity 6 Preview (6000.0)
LanguageEnglish
  • C#

GameObjectUtility

class in UnityEditor

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

Description

GameObject utility functions.

Static Methods

AreStaticEditorFlagsSetReturns true if the passed in StaticEditorFlags are set on the GameObject specified.
DuplicateGameObjectDuplicates a single GameObject and returns the new GameObject.
DuplicateGameObjectsDuplicates an array of GameObjects and returns the array of the new GameObject roots.
EnsureUniqueNameForSiblingYou can use this method after parenting one GameObject to another to ensure the child GameObject has a unique name compared to its siblings in the hierarchy.
GetMonoBehavioursWithMissingScriptCountGets the number of MonoBehaviours with a missing script for the given GameObject.
GetStaticEditorFlagsGets the StaticEditorFlags of the GameObject specified.
GetUniqueNameForSiblingYou can use this method before instantiating a new sibling, or before parenting one GameObject to another, to ensure the new child GameObject has a unique name compared to its siblings in the hierarchy.
ModifyMaskIfGameObjectIsHiddenForPrefabModeInContextUse this method if a custom scene culling mask is needed for renderers that should be shown or hidden in a Scene view when Prefab Mode in Context is active.
RemoveMonoBehavioursWithMissingScriptRemoves the MonoBehaviours with a missing script from the given GameObject.
SetParentAndAlignSets the parent and gives the child the same layer and position.
SetStaticEditorFlagsSets the StaticEditorFlags of the specified GameObject.