EditorUtility Manual     Reference     Scripting  
Scripting > Editor Classes > EditorUtility
EditorUtility Class

Editor utility functions.

Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder. Editor classes are in the UnityEditor namespace so for C# scripts you need to add "using UnityEditor;" at the beginning of the script.

Class Functions
SetDirty

Marks target object as dirty.

IsPersistent

Determines if an object is stored on disk.

DisplayDialog

Displays a modal dialog.

DisplayDialogComplex

Displays a modal dialog with three buttons.

OpenFilePanel

Displays the "open file" dialog and returns the selected path name.

SaveFilePanel

Displays the "save file" dialog and returns the selected path name.

SaveFolderPanel

Displays the "save folder" dialog and returns the selected path name.

SaveFilePanelInProject

Displays the "save file" dialog in the Assets folder of the project and returns the selected path name.

InstanceIDToObject

Translates an instance ID to a reference to an object.

CompressTexture

Compress a texture.

CloneComponent

Duplicate a component.

CopySerialized

Copy all settings of a Unity Object.

CollectDependencies

Calculates and returns a list of all assets the assets listed in roots depend on.

CollectDeepHierarchy

Calculates and returns a list of all assets the assets listed in roots depend on.

DisplayPopupMenu

Displays a popup menu.

FocusProjectWindow

Brings the project window to the front and focuses it.

FormatBytes

Returns a text for a number of bytes.

DisplayProgressBar

Displays or updates a progress bar.

ClearProgressBar

Removes progress bar.

GetObjectEnabled

Is the object enabled (0 disabled, 1 enabled, -1 has no enabled button)

SetObjectEnabled

Set the enabled state of the object

InstantiatePrefab

Instantiates the given prefab.

CreateEmptyPrefab

Creates an empty prefab at given path.

ReplacePrefab

Replaces the targetPrefab with a copy of the game object hierarchy go.

ReconnectToLastPrefab

Connects the game object to the prefab that it was last connected to.

ResetToPrefabState

Resets the properties of the component or game object to the parent prefab state

ResetGameObjectToPrefabState

Resets the properties of game object and all attached components to the parent prefab state

GetPrefabType

Given an object, returns whether it's a prefab or an instance of a prefab and what kind of prefab it is.

GetPrefabParent

Returns the GameObject parent of source, or null if it can't be found.

FindPrefabRoot

Helper function to find the prefab root of an object (used for picking niceness)

ExtractOggFile

Saves an AudioClip or MovieTexture to a file.

CreateGameObjectWithHideFlags

Creates a game object with HideFlags and specified components.