Class Editor
The main managed editor class. Editor root object.
Inheritance
Namespace: FlaxEditor
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public sealed class Editor : ObjectFields
CodeDocs
CodeEditing
ContentDatabase
The content database module.
Declaration
public ContentDatabaseModule ContentDatabaseField Value
| ContentDatabaseModule 
 | 
ContentEditing
The content editing module.
Declaration
public ContentEditingModule ContentEditingField Value
| ContentEditingModule 
 | 
ContentFinding
The content finder module.
Declaration
public ContentFindingModule ContentFindingField Value
| ContentFindingModule 
 | 
ContentImporting
The content importing module.
Declaration
public ContentImportingModule ContentImportingField Value
| ContentImportingModule 
 | 
CustomData
The custom data container that is stored in Editor instance. Can be used by plugins to store the state during editor session (state is preserved during scripts reloads).
Declaration
public Dictionary<string, string> CustomDataField Value
| System.Collections.Generic.Dictionary<System.String, System.String> 
 | 
EngineProject
GameProject
Icons
The icons container.
Declaration
public EditorIcons IconsField Value
| FlaxEditor.EditorIcons 
 | 
LocalCachePath
The path to the local cache folder shared by all the installed editor instance for a given user (used also by the Flax Launcher).
Declaration
public static readonly string LocalCachePathField Value
| System.String 
 | 
Options
Prefabs
ProgressReporting
The progress reporting module.
Declaration
public ProgressReportingModule ProgressReportingField Value
| ProgressReportingModule 
 | 
ProjectCache
The editor per-project cache manager.
Declaration
public ProjectCacheModule ProjectCacheField Value
| ProjectCacheModule 
 | 
Scene
SceneEditing
The scene editing module.
Declaration
public SceneEditingModule SceneEditingField Value
| SceneEditingModule 
 | 
Simulation
StateMachine
The editor state machine.
Declaration
public EditorStateMachine StateMachineField Value
| FlaxEditor.States.EditorStateMachine 
 | 
Thumbnails
UI
Undo
Windows
Properties
Instance
IsEveryAssemblyLoaded
Checks if every managed assembly has been loaded (including user scripts assembly).
Declaration
public static bool IsEveryAssemblyLoaded { get; }Property Value
| System.Boolean 
 | 
IsFlaxEngineTheBest
Gets a value indicating whether Flax Engine is the best in the world.
Declaration
public bool IsFlaxEngineTheBest { get; }Property Value
| System.Boolean 
 | 
IsHeadlessMode
Gets a value indicating whether this Editor is running in headless mode. No windows or popups should be shown. Used in CL environment (without a graphical user interface).
Declaration
public bool IsHeadlessMode { get; }Property Value
| System.Boolean 
 | 
IsInitialized
Gets a value indicating whether Editor instance is initialized.
Declaration
public bool IsInitialized { get; }Property Value
| System.Boolean 
 | 
IsPlayMode
True if the editor is running now in a play mode. Assigned by the managed editor instance.
Declaration
public static bool IsPlayMode { get; }Property Value
| System.Boolean 
 | 
LastProjectOpenedEngineBuild
Gets the build number of the last editor instance that opened the current project. Value 0 means the undefined version.
Declaration
public static int LastProjectOpenedEngineBuild { get; }Property Value
| System.Int32 
 | 
MainTransformGizmo
Gets the main transform gizmo used by the SceneEditorWindow.
Declaration
public TransformGizmo MainTransformGizmo { get; }Property Value
| FlaxEditor.Gizmo.TransformGizmo 
 | 
Methods
add_LightmapsBakeEnd(Editor.LightmapsBakeEndDelegate)
Declaration
public static void add_LightmapsBakeEnd(Editor.LightmapsBakeEndDelegate value)Parameters
| Editor.LightmapsBakeEndDelegate
        value 
 | 
add_LightmapsBakeProgress(Editor.LightmapsBakeProgressDelegate)
Declaration
public static void add_LightmapsBakeProgress(Editor.LightmapsBakeProgressDelegate value)Parameters
| Editor.LightmapsBakeProgressDelegate
        value 
 | 
BakeAllEnvProbes()
Bakes all environmental probes in the scene.
Declaration
public void BakeAllEnvProbes()BakeLightmapsOrCancel()
Starts lightmaps baking for the open scenes or cancels it if already running.
Declaration
public void BakeLightmapsOrCancel()BuildAllMeshesSDF()
Builds SDF for all static models in the scene.
Declaration
public void BuildAllMeshesSDF()BuildCSG()
Builds CSG for all open scenes.
Declaration
public void BuildCSG()BuildNavMesh()
BuildScenesOrCancel()
Starts building scenes data or cancels it if already running.
Declaration
public void BuildScenesOrCancel()CanExport(String)
Checks if the given asset can be exported.
Declaration
public static bool CanExport(string path)Parameters
| System.String
        path The asset path (absolute path with an extension). | 
Returns
| System.Boolean True if can export given asset, otherwise false. | 
CanImport(String, out String)
Checks if can import asset with the given extension.
Declaration
public static bool CanImport(string extension, out string outputExtension)Parameters
| System.String
        extension The file extension. | 
| System.String
        outputExtension The output file extension (flax, json, etc.). | 
Returns
| System.Boolean True if can import files with given extension, otherwise false. | 
ClearLightmaps()
Clears the lightmaps linkage for all open scenes.
Declaration
public void ClearLightmaps()CloseSplashScreen()
Closes editor splash screen popup window.
Declaration
public static void CloseSplashScreen()CookMeshCollision(String, CollisionDataType, ModelBase, Int32, UInt32, ConvexMeshGenerationFlags, Int32)
Cooks the mesh collision data and saves it to the asset using CollisionData format. action cannot be performed on a main thread.
Declaration
public static bool CookMeshCollision(string path, CollisionDataType type, ModelBase model, int modelLodIndex = 0, uint materialSlotsMask = 4294967295U, ConvexMeshGenerationFlags convexFlags, int convexVertexLimit = 255)Parameters
| System.String
        path The output asset path. | 
| CollisionDataType
        type The collision data type. | 
| ModelBase
        model The source model. | 
| System.Int32
        modelLodIndex The source model LOD index. | 
| System.UInt32
        materialSlotsMask The source model material slots mask. One bit per-slot. Can be used to exclude particular material slots from collision cooking. | 
| ConvexMeshGenerationFlags
        convexFlags The convex mesh generation flags. | 
| System.Int32
        convexVertexLimit The convex mesh vertex limit. Use values in range [8;255] | 
Returns
| System.Boolean True if failed, otherwise false. | 
CreateAsset(Editor.NewAssetType, String)
Creates new asset at the target location. [Deprecated in v1.8]
Declaration
public static bool CreateAsset(Editor.NewAssetType type, string outputPath)Parameters
| Editor.NewAssetType
        type New asset type. | 
| System.String
        outputPath Output asset path. | 
Returns
| System.Boolean 
 | 
CreateAsset(String, String)
Creates a new asset at the target location.
Declaration
[Unmanaged]
public static bool CreateAsset(string tag, string outputPath)Parameters
| System.String
        tag New asset type. | 
| System.String
        outputPath Output asset path. | 
Returns
| System.Boolean 
 | 
CreateVisualScript(String, String)
Creates new Visual Script asset at the target location.
Declaration
public static bool CreateVisualScript(string outputPath, string baseTypename)Parameters
| System.String
        outputPath Output asset path. | 
| System.String
        baseTypename Base class typename. | 
Returns
| System.Boolean 
 | 
EnsureState(EditorState)
Ensure that editor is in a given state, otherwise throws FlaxEditor.States.InvalidStateException.
Declaration
public void EnsureState(EditorState state)Parameters
| FlaxEditor.States.EditorState
        state Valid state to check. | 
Exceptions
| FlaxEditor.States.InvalidStateException 
 | 
EnsureState<TStateType>()
Ensure that editor is in a state of given type, otherwise throws FlaxEditor.States.InvalidStateException.
Declaration
public void EnsureState<TStateType>()Type Parameters
| TStateType The type of the state type. | 
Export(String, String)
Exports the given asset to the specified file location.
Declaration
public static bool Export(string inputPath, string outputFolder)Parameters
| System.String
        inputPath The input asset path (absolute path with an extension). | 
| System.String
        outputFolder The output folder path (filename with extension is computed by auto). | 
Returns
| System.Boolean True if given asset has been exported, otherwise false. | 
GetActorEditorSphere(Actor, out BoundingSphere)
Gets the actor bounding sphere (including child actors).
Declaration
public static void GetActorEditorSphere(Actor actor, out BoundingSphere sphere)Parameters
| Actor
        actor The actor. | 
| BoundingSphere
        sphere The bounding sphere. | 
GetAssetReferences(Guid)
Gets a list of asset references of a given asset.
Declaration
[Unmanaged]
public static Guid[] GetAssetReferences(Guid assetId)Parameters
| System.Guid
        assetId The asset ID. | 
Returns
| System.Guid[] List of referenced assets. | 
GetShaderSourceCode(Material)
Gets the material shader source code (HLSL shader code).
Declaration
public static string GetShaderSourceCode(Material asset)Parameters
| Material
        asset The material asset. | 
Returns
| System.String The generated source code. | 
GetShaderSourceCode(ParticleEmitter)
Gets the particle emitter GPU simulation shader source code (HLSL shader code).
Declaration
public static string GetShaderSourceCode(ParticleEmitter asset)Parameters
| ParticleEmitter
        asset The particle emitter asset. | 
Returns
| System.String The generated source code. | 
GetShaderSourceCode(Shader)
Gets the shader source code (HLSL shader code).
Declaration
public static string GetShaderSourceCode(Shader asset)Parameters
| Shader
        asset The shader asset. | 
Returns
| System.String The generated source code. | 
Import(String, String, AudioTool.Options)
Imports the audio asset file to the target location.
Declaration
[Unmanaged]
public static bool Import(string inputPath, string outputPath, AudioTool.Options options)Parameters
| System.String
        inputPath The source file path. | 
| System.String
        outputPath The result asset file path. | 
| FlaxEngine.Tools.AudioTool.Options
        options The import settings. | 
Returns
| System.Boolean True if importing failed, otherwise false. | 
Import(String, String, ModelTool.Options)
Imports the model asset file to the target location.
Declaration
[Unmanaged]
public static bool Import(string inputPath, string outputPath, ModelTool.Options options)Parameters
| System.String
        inputPath The source file path. | 
| System.String
        outputPath The result asset file path. | 
| FlaxEngine.Tools.ModelTool.Options
        options The import settings. | 
Returns
| System.Boolean True if importing failed, otherwise false. | 
Import(String, String, TextureTool.Options)
Imports the texture asset file to the target location.
Declaration
[Unmanaged]
public static bool Import(string inputPath, string outputPath, TextureTool.Options options)Parameters
| System.String
        inputPath The source file path. | 
| System.String
        outputPath The result asset file path. | 
| FlaxEngine.Tools.TextureTool.Options
        options The import settings. | 
Returns
| System.Boolean True if importing failed, otherwise false. | 
Import(String, String, IntPtr)
Imports the asset file to the target location.
Declaration
[Unmanaged]
public static bool Import(string inputPath, string outputPath, IntPtr arg = default(IntPtr))Parameters
| System.String
        inputPath The source file path. | 
| System.String
        outputPath The result asset file path. | 
| System.IntPtr
        arg The custom argument 9native data). | 
Returns
| System.Boolean True if importing failed, otherwise false. | 
NewProject(String)
Creates the given project. Afterwards closes this project with running editor and opens the given project.
Declaration
public void NewProject(string projectFilePath)Parameters
| System.String
        projectFilePath The project file path. | 
OpenProject(String)
Closes this project with running editor and opens the given project.
Declaration
public void OpenProject(string projectFilePath)Parameters
| System.String
        projectFilePath The project file path. | 
PerformRedo()
Redo last action.
Declaration
public void PerformRedo()PerformUndo()
Undo last action.
Declaration
public void PerformUndo()remove_LightmapsBakeEnd(Editor.LightmapsBakeEndDelegate)
Declaration
public static void remove_LightmapsBakeEnd(Editor.LightmapsBakeEndDelegate value)Parameters
| Editor.LightmapsBakeEndDelegate
        value 
 | 
remove_LightmapsBakeProgress(Editor.LightmapsBakeProgressDelegate)
Declaration
public static void remove_LightmapsBakeProgress(Editor.LightmapsBakeProgressDelegate value)Parameters
| Editor.LightmapsBakeProgressDelegate
        value 
 | 
SaveAll()
Saves all changes (scenes, assets, etc.).
Declaration
public void SaveAll()SaveContent()
Saves all content (assets, etc.).
Declaration
public void SaveContent()SaveJsonAsset(String, Object)
Serializes the given object to json asset.
Declaration
public static bool SaveJsonAsset(string outputPath, object obj)Parameters
| System.String
        outputPath The result asset file path. | 
| System.Object
        obj The obj to serialize. | 
Returns
| System.Boolean True if saving failed, otherwise false. | 
TryRestoreImportOptions(ref AudioTool.Options, String)
Tries the restore the asset import options from the target resource file.
Declaration
[Unmanaged]
public static bool TryRestoreImportOptions(ref AudioTool.Options options, string assetPath)Parameters
| FlaxEngine.Tools.AudioTool.Options
        options The options. | 
| System.String
        assetPath The asset path. | 
Returns
| System.Boolean True settings has been restored, otherwise false. | 
TryRestoreImportOptions(ref ModelTool.Options, String)
Tries the restore the asset import options from the target resource file.
Declaration
[Unmanaged]
public static bool TryRestoreImportOptions(ref ModelTool.Options options, string assetPath)Parameters
| FlaxEngine.Tools.ModelTool.Options
        options The options. | 
| System.String
        assetPath The asset path. | 
Returns
| System.Boolean True settings has been restored, otherwise false. | 
TryRestoreImportOptions(ref TextureTool.Options, String)
Tries the restore the asset import options from the target resource file.
Declaration
[Unmanaged]
public static bool TryRestoreImportOptions(ref TextureTool.Options options, string assetPath)Parameters
| FlaxEngine.Tools.TextureTool.Options
        options The options. | 
| System.String
        assetPath The asset path. | 
Returns
| System.Boolean True settings has been restored, otherwise false. | 
Events
EditorUpdate
Fired on Editor update
Declaration
public event Action EditorUpdateEvent Type
| System.Action 
 | 
EnvProbeBakeEnd
Occurs when environment probe baking ends.
Declaration
public static event Action<EnvironmentProbe> EnvProbeBakeEndEvent Type
| System.Action<EnvironmentProbe> 
 | 
EnvProbeBakeStart
Occurs when environment probe baking starts.
Declaration
public static event Action<EnvironmentProbe> EnvProbeBakeStartEvent Type
| System.Action<EnvironmentProbe> 
 | 
InitializationEnd
Occurs when editor initialization ends. All editor modules already received OnEndInit callback and editor splash screen will be closed.
Declaration
public event Action InitializationEndEvent Type
| System.Action 
 | 
InitializationStart
Occurs when editor initialization starts. All editor modules already received OnInit callback and editor splash screen is visible.
Declaration
public event Action InitializationStartEvent Type
| System.Action 
 | 
LightmapsBakeEnd
Occurs when lightmaps baking ends.
Declaration
public static event Editor.LightmapsBakeEndDelegate LightmapsBakeEndEvent Type
| Editor.LightmapsBakeEndDelegate 
 | 
LightmapsBakeProgress
Occurs when lightmaps baking progress changes.
Declaration
public static event Editor.LightmapsBakeProgressDelegate LightmapsBakeProgressEvent Type
| Editor.LightmapsBakeProgressDelegate 
 | 
LightmapsBakeStart
Occurs when lightmaps baking starts.
Declaration
public static event Action LightmapsBakeStartEvent Type
| System.Action 
 | 
PlayModeBegin
Occurs when play mode begins (after entering play mode).
Declaration
public event Action PlayModeBeginEvent Type
| System.Action 
 | 
PlayModeBeginning
Occurs when play mode is beginning (before entering play mode).
Declaration
public event Action PlayModeBeginningEvent Type
| System.Action 
 | 
PlayModeEnd
Occurs when play mode ends (after leaving play mode).
Declaration
public event Action PlayModeEndEvent Type
| System.Action 
 | 
PlayModeEnding
Occurs when play mode is ending (before leaving play mode).
Declaration
public event Action PlayModeEndingEvent Type
| System.Action 
 |