EditorUtilityclass

object→EditorUtility
Namespace
Editor
Assembly
Sandbox.Tools
Declaration
public static abstract sealed class Editor.EditorUtility

Methods59

Showing 59 methods

public static void AddLogger(System.Action`1<Sandbox.LogEvent> logger)PUBLICSTATIC

ParameterTypeDescription
loggerAction<LogEvent>—
Returns:void—

public static void ApplyGraphicsPreset(Sandbox.Engine.Settings.GraphicsPreset preset)PUBLICSTATIC

Write every setting a graphics preset covers.

ParameterTypeDescription
presetGraphicsPreset—
Returns:void—

public static void ClearPackageCache()PUBLICSTATIC

Delete the cached package info. This will cause any future requests to get fresh information from the backend. This is useful if you just updated something and want to see the changes.

Returns:void—

public static bool CopyAsset(Editor.Asset asset, string path, bool overwrite = False)PUBLICSTATIC

Create a copy of an asset (and related files) on a new path.

ParameterTypeDescription
assetAsset—
pathstring—
overwrite = Falsebool—
Returns:bool—

public static void CopyAssetToDirectory(Editor.Asset asset, string directory, bool overwrite = True)PUBLICSTATIC

Copies an asset's source and compiled files to a directory (if they exist)

ParameterTypeDescription
assetAsset—
directorystring—
overwrite = Truebool—
Returns:void—

public static Editor.Asset CreateModelFromMeshComponents(Sandbox.MeshComponent[] meshComponents, string targetAbsolutePath)PUBLICSTATIC

Create a vmdl file from mesh components. Will return non null if the asset was created successfully. The model's origin will be placed at the first mesh component's position.

ParameterTypeDescription
meshComponentsMeshComponent[]—
targetAbsolutePathstring—
Returns:Asset—

public static Editor.Asset CreateModelFromMeshFile(Editor.Asset meshFile, string targetAbsolutePath = null)PUBLICSTATIC

Create a vmdl file from a mesh. Will return non null if the asset was created successfully

ParameterTypeDescription
meshFileAsset—
targetAbsolutePath = nullstring—
Returns:Asset—

public static Editor.Asset CreateModelFromPolygonMeshes(Sandbox.PolygonMesh[] polygonMeshes, string targetAbsolutePath)PUBLICSTATIC

Create a vmdl file from polygon meshes. Will return non null if the asset was created successfully

ParameterTypeDescription
polygonMeshesPolygonMesh[]—
targetAbsolutePathstring—
Returns:Asset—

public static Sandbox.WebSurface CreateWebSurface()PUBLICSTATIC

Create an unlimited web surface

Returns:WebSurface—

public static Sandbox.Engine.Settings.GraphicsPreset DetectGraphicsPreset()PUBLICSTATIC

The graphics preset this machine should start on.

Returns:GraphicsPreset—

public static System.IDisposable DisableTextureStreaming()PUBLICSTATIC

Force textures to load fully when loading a model etc..

Returns:IDisposable—

public static System.Threading.Tasks.Task`1<bool> DownloadAsync(string url, string targetfile, Sandbox.Utility.DataProgress.Callback progress = null, System.Threading.CancellationToken token = null)PUBLICSTATIC

ParameterTypeDescription
urlstring—
targetfilestring—
progress = nullCallback—
token = nullCancellationToken—
Returns:Task<bool>—

public static Sandbox.Project FindProjectByDirectory(string fullPath)PUBLICSTATIC

Tries to find a project based on a given directory.

ParameterTypeDescription
fullPathstring—
Returns:Project—

public static Editor.Asset GetAssetFromProject(Sandbox.Project project)PUBLICSTATIC

ParameterTypeDescription
projectProject—
Returns:Asset—

public static Editor.Pixmap GetFileThumbnail(string filePath, int width, int height)PUBLICSTATIC

ParameterTypeDescription
filePathstring—
widthint—
heightint—
Returns:Pixmap—

public static System.Collections.Generic.HashSet`1<Sandbox.Internal.IPanel> GetRootPanels()PUBLICSTATIC

Get all the root panels.

Returns:HashSet<IPanel>—

public static string GetSearchPaths()PUBLICSTATIC

Gets every search path seperated by ;

Returns:string—

public static Sandbox.SerializedObject GetSerializedObject(object obj)PUBLICSTATIC

Get a serialized object for this object. Because you're in the editor, this is an unrestricted object, we aren't whitelisting or using TypeLibrary.

ParameterTypeDescription
objobject—
Returns:SerializedObject—

public static Facepunch.ActionGraphs.ISourceLocation GetSourceLocation(Sandbox.Scene scene)PUBLICSTATIC

Gets the source location for the given scene, used by action graph stack traces, and so the action graph editor knows which asset to save when editing a graph.

ParameterTypeDescription
sceneScene—
Returns:ISourceLocation—

public static bool IsCodeFile(string fullPath)PUBLICSTATIC

Checks if a given file is a code file

ParameterTypeDescription
fullPathstring—
Returns:bool—

public static bool IsCodeFolder(string fullPath)PUBLICSTATIC

Checks if a given folder is a code folder, e.g. [project root]/Code

ParameterTypeDescription
fullPathstring—
Returns:bool—

public static string KeyValues1ToJson(string kvString)PUBLICSTATIC

Some old ass assets are keyvalues (1). Convert them to Json so we can use them.

ParameterTypeDescription
kvStringstring—
Returns:string—

public static string KeyValues3ToJson(string kvString)PUBLICSTATIC

Some assets are kv3, we want to convert them to json

ParameterTypeDescription
kvStringstring—
Returns:string—

public static Sandbox.Utility.FloatBitmap LoadBitmap(string filename)PUBLICSTATIC

Load a float bitmap. This is usually a png, tga, exr, psd

ParameterTypeDescription
filenamestring—
Returns:FloatBitmap—

public static T LoadProjectSettings(string filename)PUBLICSTATIC

Load a project settings file

ParameterTypeDescription
filenamestring—
Returns:T—

public static bool MoveAsset(Editor.Asset asset, string path, bool overwrite = False)PUBLICSTATIC

Moves an asset (and related files) to a new path.

ParameterTypeDescription
assetAsset—
pathstring—
overwrite = Falsebool—
Returns:bool—

public static void MoveAssetToDirectory(Editor.Asset asset, string directory, bool overwrite = True)PUBLICSTATIC

Moves an asset's source and compiled files to a directory (if they exist)

ParameterTypeDescription
assetAsset—
directorystring—
overwrite = Truebool—
Returns:void—

public static Editor.Widget OpenControlSheet(Sandbox.SerializedObject so, Editor.Widget parent, bool createWindow = True)PUBLICSTATIC

Show a popup control sheet for this. You should set parent to the control from this this sheet is created. If you do that properly, when that control is deleted, this popup will get deleted too. If you set it to null then the control sheet will stay open until it's closed.

ParameterTypeDescription
soSerializedObject—
parentWidget—
createWindow = Truebool—
Returns:Widget—

public static void OpenFile(string path)PUBLICSTATIC

Open a folder (or url)

ParameterTypeDescription
pathstring—
Returns:void—

public static string OpenFileDialog(string title, string extension, string defaultPath)PUBLICSTATIC

Open a file open dialog. Returns null on cancel, else the absolute path of the target file.

ParameterTypeDescription
titlestring—
extensionstring—
defaultPathstring—
Returns:string—

public static void OpenFileFolder(string filepath)PUBLICSTATIC

Open given file's folder in OS file explorer and select given file.

ParameterTypeDescription
filepathstring—
Returns:void—

public static void OpenFolder(string path)PUBLICSTATIC

Open a folder (or url)

ParameterTypeDescription
pathstring—
Returns:void—

public static bool PlayRawSound(string file)PUBLICSTATIC

Plays a sound via the OS, which is the way you play a sound if you want it to be heard when the game is tabbed away

ParameterTypeDescription
filestring—
Returns:bool—

public static Sandbox.SoundHandle PlaySound(string sound, float startTime = 0)PUBLICSTATIC

Plays a sound event

ParameterTypeDescription
soundstring—
startTime = 0float—
Returns:SoundHandle—

public static System.Threading.Tasks.Task`1<bool> PutAsync(System.IO.Stream fileStream, string endpoint, Sandbox.Utility.DataProgress.Callback progress = null, System.Threading.CancellationToken token = null)PUBLICSTATIC

ParameterTypeDescription
fileStreamStream—
endpointstring—
progress = nullCallback—
token = nullCancellationToken—
Returns:Task<bool>—

public static void Quit(bool toLauncher = False)PUBLICSTATIC

Quit the whole engine

ParameterTypeDescription
toLauncher = FalseboolOpen the launcher on exit, if it's not already open.
Returns:void—

public static void RemoveLogger(System.Action`1<Sandbox.LogEvent> logger)PUBLICSTATIC

ParameterTypeDescription
loggerAction<LogEvent>—
Returns:void—

public static bool RenameAsset(Editor.Asset asset, string newName, bool overwrite = False)PUBLICSTATIC

Rename an asset (and related files) to a new name

ParameterTypeDescription
assetAsset—
newNamestring—
overwrite = Falsebool—
Returns:bool—

public static void RenameDirectory(string directory, string newDirectory, bool recursive = False)PUBLICSTATIC

ParameterTypeDescription
directorystring—
newDirectorystring—
recursive = Falsebool—
Returns:void—

public static void RestartEditor()PUBLICSTATIC

Restarts the editor with the same project.

Returns:void—

public static void RestartEditorPrompt(string message, string title = Restart Editor)PUBLICSTATIC

Open a dialog prompt asking the user to restart the editor.

ParameterTypeDescription
messagestring—
title = Restart Editorstring—
Returns:void—

public static string SaveFileDialog(string title, string extension, string defaultPath)PUBLICSTATIC

Open a file save dialog. Returns null on cancel, else the absolute path of the target file.

ParameterTypeDescription
titlestring—
extensionstring—
defaultPathstring—
Returns:string—

public static void SaveProjectSettings(T data, string filename)PUBLICSTATIC

Save a project settings file

ParameterTypeDescription
dataT—
filenamestring—
Returns:void—

public static void SendToRecycleBin(string filename)PUBLICSTATIC

ParameterTypeDescription
filenamestring—
Returns:void—

public static void StopAssetSound()PUBLICSTATIC

Stop a sound playing from an asset preview

Returns:void—

public static System.Threading.Tasks.Task`1<string> TranslateString(string input, string language)PUBLICSTATIC

Translate input into language

ParameterTypeDescription
inputstring—
languagestring—
Returns:Task<string>—

Properties6

Showing 6 properties

public static Sandbox.Engine.Settings.GraphicsPreset Editor.EditorUtility.CurrentGraphicsPreset { get; set; }PUBLICSTATICGETSET

Which preset the current settings add up to, or Custom if they don't match one.

Returns:GraphicsPreset—

public static System.Collections.Generic.IEnumerable`1<string> Editor.EditorUtility.FontFamilies { get; set; }PUBLICSTATICGETSET

Returns:IEnumerable<string>—

public static object Editor.EditorUtility.InspectorObject { get; set; }PUBLICSTATICGETSET

Set the object to be inspected by the inspector.

Returns:object—

public static bool Editor.EditorUtility.IsRecordingVideo { get; set; }PUBLICSTATICGETSET

True if we're currently recording a video (using the video command, or F6)

Returns:bool—

public static bool Editor.EditorUtility.IsVulkan { get; set; }PUBLICSTATICGETSET

Used for shadergraph

Returns:bool—

On this page

Methodspublic static System.Void AddLogger(System.Action`1<Sandbox.LogEvent> logger)public static System.Void ApplyGraphicsPreset(Sandbox.Engine.Settings.GraphicsPreset preset)public static Sandbox.ConCmdAttribute.AutoCompleteResult[] AutoComplete(System.String text, System.Int32 maxCount)public static System.Void ClearPackageCache()public static System.Threading.Tasks.Task`1<Sandbox.Engine.Shaders.ShaderCompile.Results> CompileShader(Sandbox.BaseFileSystem fs, System.String localPath, Sandbox.Engine.Shaders.ShaderCompileOptions options, System.Threading.CancellationToken token = null)public static System.Threading.Tasks.Task`1<Sandbox.Engine.Shaders.ShaderCompile.Results> CompileShader(System.String localPath, Sandbox.Engine.Shaders.ShaderCompileOptions options, System.Threading.CancellationToken token = null)public static System.Boolean CopyAsset(Editor.Asset asset, System.String path, System.Boolean overwrite = False)public static System.Void CopyAssetToDirectory(Editor.Asset asset, System.String directory, System.Boolean overwrite = True)public static Editor.Asset CreateModelFromMeshComponents(Sandbox.MeshComponent[] meshComponents, System.String targetAbsolutePath)public static Editor.Asset CreateModelFromMeshFile(Editor.Asset meshFile, System.String targetAbsolutePath = null)public static Editor.Asset CreateModelFromPolygonMeshes(Sandbox.PolygonMesh[] polygonMeshes, System.String targetAbsolutePath)public static Sandbox.SceneWorld CreateSceneWorld()public static Sandbox.VideoWriter CreateVideoWriter(System.String path, Sandbox.VideoWriter.Config config)public static Sandbox.WebSurface CreateWebSurface()public static Sandbox.Engine.Settings.GraphicsPreset DetectGraphicsPreset()public static System.IDisposable DisableTextureStreaming()public static System.Void DisplayDialog(System.String title, System.String message, System.String okay = Okay, System.String icon = ⚠️, Editor.Widget parent = null)public static System.Void DisplayDialog(System.String title, System.String message, System.String noLabel, System.String yesLabel, System.Action action, System.String icon = ❓, Editor.Widget parent = null)public static System.Threading.Tasks.Task`1<System.Boolean> DownloadAsync(System.String url, System.String targetfile, Sandbox.Utility.DataProgress.Callback progress = null, System.Threading.CancellationToken token = null)public static System.Void FindInScene(Sandbox.Component component)public static System.Void FindInScene(Sandbox.GameObject go)public static Sandbox.Project FindProjectByDirectory(System.String fullPath)public static Editor.Asset GetAssetFromProject(Sandbox.Project project)public static Editor.Pixmap GetFileThumbnail(System.String filePath, System.Int32 width, System.Int32 height)public static Sandbox.GameObjectSystem GetGameObjectSystem(Sandbox.Scene scene, Sandbox.TypeDescription fromType)public static System.Collections.Generic.HashSet`1<Sandbox.Internal.IPanel> GetRootPanels()public static System.String GetSearchPaths()public static Sandbox.SerializedObject GetSerializedObject(System.Object obj)public static Facepunch.ActionGraphs.ISourceLocation GetSourceLocation(Sandbox.Scene scene)public static System.Boolean IsCodeFile(System.String fullPath)public static System.Boolean IsCodeFolder(System.String fullPath)public static System.String KeyValues1ToJson(System.String kvString)public static System.String KeyValues3ToJson(System.String kvString)public static Sandbox.Utility.FloatBitmap LoadBitmap(System.String filename)public static T LoadProjectSettings(System.String filename)public static System.Boolean MoveAsset(Editor.Asset asset, System.String path, System.Boolean overwrite = False)public static System.Void MoveAssetToDirectory(Editor.Asset asset, System.String directory, System.Boolean overwrite = True)public static Editor.Widget OpenControlSheet(Sandbox.SerializedObject so, Editor.Widget parent, System.Boolean createWindow = True)public static System.Void OpenFile(System.String path)public static System.String OpenFileDialog(System.String title, System.String extension, System.String defaultPath)public static System.Void OpenFileFolder(System.String filepath)public static System.Void OpenFolder(System.String path)public static System.Boolean PlayAssetSound(Editor.Asset asset)public static System.Boolean PlayAssetSound(Sandbox.SoundEvent file)public static System.Boolean PlayAssetSound(Sandbox.SoundFile file)public static System.Boolean PlayRawSound(System.String file)public static Sandbox.SoundHandle PlaySound(System.String sound, System.Single startTime = 0)public static System.Threading.Tasks.Task`1<System.Boolean> PutAsync(System.IO.Stream fileStream, System.String endpoint, Sandbox.Utility.DataProgress.Callback progress = null, System.Threading.CancellationToken token = null)public static System.Void Quit(System.Boolean toLauncher = False)public static System.Void RemoveLogger(System.Action`1<Sandbox.LogEvent> logger)public static System.Boolean RenameAsset(Editor.Asset asset, System.String newName, System.Boolean overwrite = False)public static System.Void RenameDirectory(System.String directory, System.String newDirectory, System.Boolean recursive = False)public static System.Void RestartEditor()public static System.Void RestartEditorPrompt(System.String message, System.String title = Restart Editor)public static System.String SaveFileDialog(System.String title, System.String extension, System.String defaultPath)public static System.Void SaveProjectSettings(T data, System.String filename)public static System.Void SendToRecycleBin(System.String filename)public static System.Void StopAssetSound()public static System.Threading.Tasks.Task`1<System.String> TranslateString(System.String input, System.String language)Propertiespublic static Sandbox.Engine.Settings.GraphicsPreset Editor.EditorUtility.CurrentGraphicsPreset { get; set; }public static System.Collections.Generic.IEnumerable`1<System.String> Editor.EditorUtility.FontFamilies { get; set; }public static System.Object Editor.EditorUtility.InspectorObject { get; set; }public static System.Boolean Editor.EditorUtility.IsRecordingVideo { get; set; }public static System.Boolean Editor.EditorUtility.IsVulkan { get; set; }public static Sandbox.Engine.Settings.RenderSettings Editor.EditorUtility.RenderSettings { get; set; }Metadata