Class ScriptsBuilder
Game scrips building service. Compiles user C# scripts into binary assemblies. Exposes many events used to track scripts compilation and reloading.
Inheritance
Namespace: FlaxEditor
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public static class ScriptsBuilder : Object
Properties
BuildToolPath
Gets the full path to the Flax.Build app.
Declaration
[Unmanaged]
public static string BuildToolPath { get; }
Property Value
System.String
|
CompilationsCount
Gets amount of source code compile actions since Editor startup.
Declaration
[Unmanaged]
public static int CompilationsCount { get; }
Property Value
System.Int32
|
IsCompiling
Returns true if scripts are being now compiled/reloaded.
Declaration
[Unmanaged]
public static bool IsCompiling { get; }
Property Value
System.Boolean
|
IsReady
Returns true if source code has been compiled and assemblies are ready to load.
Declaration
[Unmanaged]
public static bool IsReady { get; }
Property Value
System.Boolean
|
IsSourceDirty
Returns true if source code has been edited.
Declaration
[Unmanaged]
public static bool IsSourceDirty { get; }
Property Value
System.Boolean
|
IsSourceWorkspaceDirty
Returns true if source code workspace has been edited (source file moved or deleted).
Declaration
[Unmanaged]
public static bool IsSourceWorkspaceDirty { get; }
Property Value
System.Boolean
|
LastCompilationFailed
Checks if last scripting building failed due to errors.
Declaration
[Unmanaged]
public static bool LastCompilationFailed { get; }
Property Value
System.Boolean
|
Methods
add_CompilationEnd(ScriptsBuilder.CompilationEndDelegate)
Declaration
public static void add_CompilationEnd(ScriptsBuilder.CompilationEndDelegate value)
Parameters
ScriptsBuilder.CompilationEndDelegate
value
|
CheckForCompile()
Checks if need to compile source code. If so calls compilation.
Declaration
[Unmanaged]
public static void CheckForCompile()
Compile()
Requests project source code compilation.
Declaration
[Unmanaged]
public static void Compile()
FindScript(String)
Tries to find a script type with the given name.
Declaration
[Unmanaged]
public static Type FindScript(string scriptName)
Parameters
System.String
scriptName
The script full name. |
Returns
System.Type
Found script type or null if missing or invalid name. |
GenerateProject(String)
Generates the project files.
Declaration
[Unmanaged]
public static bool GenerateProject(string customArgs = null)
Parameters
System.String
customArgs
The additional Flax.Build tool invocation arguments. |
Returns
System.Boolean
True if failed, otherwise false. |
GetBinariesConfiguration(out String, out String, out String, out String)
Gets the options for the game scripts to use for the Editor.
Declaration
[Unmanaged]
public static void GetBinariesConfiguration(out string target, out string platform, out string architecture, out string configuration)
Parameters
System.String
target
|
System.String
platform
|
System.String
architecture
|
System.String
configuration
|
GetExistingEditors(Int32*, Int32)
Gets the list of existing in-build code editors.
Declaration
[Unmanaged]
public static void GetExistingEditors(int *result, int count)
Parameters
System.Int32*
result
|
System.Int32
count
|
IsSourceDirtyFor(TimeSpan)
Returns true if source code has been edited and is dirty for given amount of time
Declaration
[Unmanaged]
public static bool IsSourceDirtyFor(TimeSpan timeout)
Parameters
System.TimeSpan
timeout
Time to use for checking. |
Returns
System.Boolean
True if source code is dirty, otherwise false. |
MarkWorkspaceDirty()
Indicates that scripting directory has been modified so scripts need to be rebuild.
Declaration
[Unmanaged]
public static void MarkWorkspaceDirty()
remove_CompilationEnd(ScriptsBuilder.CompilationEndDelegate)
Declaration
public static void remove_CompilationEnd(ScriptsBuilder.CompilationEndDelegate value)
Parameters
ScriptsBuilder.CompilationEndDelegate
value
|
RunBuildTool(String, String)
Invokes the Flax.Build tool in the current project workspace and waits for the process end (blocking). Prints the build tool output to the log. Can be invoked from any thread.
Declaration
[Unmanaged]
public static bool RunBuildTool(string args, string workingDir = null)
Parameters
System.String
args
The Flax.Build tool invocation arguments. |
System.String
workingDir
The custom working directory. Use empty or null to execute build tool in the project folder. |
Returns
System.Boolean
True if failed, otherwise false. |
Events
CodeEditorAsyncOpenBegin
Occurs when code editor starts asynchronous open a file or a solution.
Declaration
public static event Action CodeEditorAsyncOpenBegin
Event Type
System.Action
|
CodeEditorAsyncOpenEnd
Occurs when code editor ends asynchronous open a file or a solution.
Declaration
public static event Action CodeEditorAsyncOpenEnd
Event Type
System.Action
|
CompilationBegin
Occurs when compilation begins.
Declaration
public static event Action CompilationBegin
Event Type
System.Action
|
CompilationEnd
Occurs when compilation ends.
Declaration
public static event ScriptsBuilder.CompilationEndDelegate CompilationEnd
Event Type
ScriptsBuilder.CompilationEndDelegate
|
CompilationFailed
Occurs when compilation failed.
Declaration
public static event Action CompilationFailed
Event Type
System.Action
|
CompilationStarted
Occurs when compilation just started.
Declaration
public static event Action CompilationStarted
Event Type
System.Action
|
CompilationSuccess
Occurs when compilation success.
Declaration
public static event Action CompilationSuccess
Event Type
System.Action
|
ScriptsLoaded
Occurs when engine loads game scripts.
Declaration
public static event Action ScriptsLoaded
Event Type
System.Action
|
ScriptsReload
Occurs when user scripts reload is performed (just before the actual reload, scenes are serialized and unloaded). All user objects should be cleanup.
Declaration
public static event Action ScriptsReload
Event Type
System.Action
|
ScriptsReloadBegin
Occurs when user scripts reload starts. User objects should be removed at this point to reduce leaks and issues. Game scripts and game editor scripts assemblies will be reloaded.
Declaration
public static event Action ScriptsReloadBegin
Event Type
System.Action
|
ScriptsReloadCalled
Occurs when user scripts reload action is called.
Declaration
public static event Action ScriptsReloadCalled
Event Type
System.Action
|
ScriptsReloadEnd
Occurs when user scripts reload ends.
Declaration
public static event Action ScriptsReloadEnd
Event Type
System.Action
|