s&box docs

public static abstract sealed class Editor.EditorUtility

Methods

Showing 55 methods

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

public static void ClearPackageCache()

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.

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

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

Parameters

  • overwrite: Default: True

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

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.

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

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

Parameters

  • targetAbsolutePath: Default: null

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

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

public static Sandbox.SceneWorld CreateSceneWorld()

public static Sandbox.WebSurface CreateWebSurface()

Create an unlimited web surface

public static System.IDisposable DisableTextureStreaming()

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

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

Parameters

  • progress: Default: null
  • token: Default: null

public static Sandbox.Project FindProjectByDirectory(string fullPath)

Tries to find a project based on a given directory.

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

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

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

Get all the root panels.

public static string GetSearchPaths()

Gets every search path seperated by ;

public static Sandbox.SerializedObject GetSerializedObject(object obj)

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.

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

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.

public static bool IsCodeFile(string fullPath)

Checks if a given file is a code file

public static bool IsCodeFolder(string fullPath)

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

public static string KeyValues1ToJson(string kvString)

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

public static string KeyValues3ToJson(string kvString)

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

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

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

public static T LoadProjectSettings(string filename)

Load a project settings file

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

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

Parameters

  • overwrite: Default: True

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

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.

Parameters

  • createWindow: Default: True

public static void OpenFile(string path)

Open a folder (or url)

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

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

public static void OpenFileFolder(string filepath)

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

public static void OpenFolder(string path)

Open a folder (or url)

public static bool PlayRawSound(string file)

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

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

Plays a sound event

Parameters

  • startTime: Default: 0

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)

Parameters

  • progress: Default: null
  • token: Default: null

public static void Quit(bool toLauncher = False)

Quit the whole engine

Parameters

  • toLauncher: Open the launcher on exit, if it's not already open. Default: False

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

public static bool RenameAsset(Editor.Asset asset, string newName)

Moves a file to the same directory but gives it a new name

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

Parameters

  • recursive: Default: False

public static void RestartEditor()

Restarts the editor with the same project.

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

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

Parameters

  • title: Default: Restart Editor

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

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

public static void SaveProjectSettings(T data, string filename)

Save a project settings file

public static void SendToRecycleBin(string filename)

public static void StopAssetSound()

Stop a sound playing from an asset preview

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

Translate input into language

Properties

Showing 5 properties

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

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

Set the object to be inspected by the inspector.

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

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

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

Used for shadergraph

Metadata

FieldValue
NamespaceEditor
Typeclass
AssemblySandbox.Tools
Doc IDT:Editor.EditorUtility

On this page

Methodspublic static System.Void AddLogger(System.Action`1<Sandbox.LogEvent> logger)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.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 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.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)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 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