My Project
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Properties | List of all members
RoslynCSharp.ScriptDomain Class Reference

A ScriptDomain acts as a container for all code that is loaded dynamically at runtime. The main responsiblility of the domin is to separate pre-compiled game code from runtime-loaded code. As a result, you will only be able to access types from the domain that were loaded at runtime. Any pre-compiled game code will be ignored. Any assemblies or scripts that are loaded into the domain at runtime will remain until the application exits so you should be careful to avoid loading too many assemblies. You would typically load user code at statup in a 'Load' method which would then exist and execute until the game exits. Multiple domain instances may be created but you should note that all runtime code will be loaded into the current application domain. The ScriptDomain simply masks the types that are visible. More...

Inheritance diagram for RoslynCSharp.ScriptDomain:

Public Member Functions

ScriptAssembly LoadAssemblyFromResources (string resourcePath, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings)
 Attempts to load a managed assembly from the specified resources path into the sandbox app domain. The target asset must be a TextAsset in order to be loaded successfully. Use SecurityResult to get the output from the code validation request.
 
ScriptAssembly LoadAssembly (string fullPath, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings)
 Attempts to load the specified managed assembly into the sandbox app domain. Use SecurityResult to get the output from the code validation request.
 
ScriptAssembly LoadAssemblyWithSymbols (string assemblyPath, string symbolsPath, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings)
 Attempts to load the specified managed assembly into the sandbox app domain along with pdb debug symbols. Use this method if you want to be able to debug the specified assembly. Use SecurityResult to get the output from the code validation request.
 
ScriptAssembly LoadAssembly (AssemblyName name, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings)
 Attempts to load the specified managed assembly into the sandbox app domain. Use SecurityResult to get the output from the code validation request.
 
ScriptAssembly LoadAssembly (byte[] assemblyBytes, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings)
 Attempts to load a managed assembly from the specified raw bytes. Use SecurityResult to get the output from the code validation request.
 
ScriptAssembly LoadAssemblyWithSymbols (byte[] assemblyBytes, byte[] symbolBytes, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings)
 Attempts to load a managed assembly from the specified raw bytes along with debug symbols. Use this method if you want to be able to debug the specified assembly. Use SecurityResult to get the output from the code validation request.
 
AsyncLoadOperation LoadAssemblyAsync (string fullPath, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings)
 Attempts to load a managed assembly from the specified filepath asynchronously. Use SecurityResult of AsyncLoadOperation.LoadDomain to get the output from the code validation request.
 
AsyncLoadOperation LoadAssemblyWithSymbolsAsync (string assemblyPath, string symbolsPath, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings)
 Attempts to load a managed assembly from the specified filepath asynchronously. Use this method if you want to be able to debug the specified assembly. Use SecurityResult of AsyncLoadOperation.LoadDomain to get the output from the code validation request.
 
AsyncLoadOperation LoadAssemblyAsync (AssemblyName name, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings)
 Attempts to load a managed assembly with the specified name asynchronously. Use SecurityResult of AsyncLoadOperation.LoadDomain to get the output from the code validation request.
 
AsyncLoadOperation LoadAssemblyAsync (byte[] assemblyBytes, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings)
 Attempts to load a managed assembly from the specified raw bytes asynchronously. Use SecurityResult of AsyncLoadOperation.LoadDomain to get the output from the code validation request.
 
AsyncLoadOperation LoadAssemblyWithSymbolsAsync (byte[] assemblyBytes, byte[] symbolBytes, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings)
 Attempts to load a managed assembly from the specified raw bytes asynchronously. Use SecurityResult of AsyncLoadOperation.LoadDomain to get the output from the code validation request. Use this method if you want to be able to debug the specified assembly.
 
bool TryLoadAssembly (string fullPath, out ScriptAssembly result, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings)
 Attempts to load the managed assembly at the specified location. Any exceptions throw while loading will be caught.
 
bool TryLoadAssembly (AssemblyName name, out ScriptAssembly result, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings)
 Attempts to load a managed assembly with the specified name. Any exceptions thrown while loading will be caught.
 
bool TryLoadAssembly (byte[] data, out ScriptAssembly result, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings)
 Attempts to load a managed assembly from the raw assembly data. Any exceptions thrown while loading will be caught.
 
ScriptType CompileAndLoadMainSource (string cSharpSource, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 Compile and load the speciied C# source code string. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request. This does the same as CompileAndLoadSource(string, ScriptSecurityMode) but returns the main type of the ScriptAssembly for convenience. ///.
 
ScriptType CompileAndLoadMainFile (string cSharpFile, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 Compile and load the specified C# source file. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request. This does the same as CompileAndLoadFileAsync(string, ScriptSecurityMode) but returns the main type of the ScriptAssembly for convenience.
 
ScriptType CompileAndLoadMainSyntaxTree (CSharpSyntaxTree syntaxTree, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 Compile and load the specified C# syntax tree. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request. This does the same as CompileAndLoadSyntaxTree(CSharpSyntaxTree, ScriptSecurityMode, IMetadataReferenceProvider[]) but returns the main type of the ScriptAssembly for convenience.
 
ScriptAssembly CompileAndLoadSource (string cSharpSource, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 Compile and load the specified C# source code string. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request.
 
ScriptAssembly CompileAndLoadFile (string cSharpFile, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 Compile and load the specified C# source file. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request.
 
ScriptAssembly CompileAndLoadDirectory (string directoryPath, string searchPattern="*.cs", SearchOption searchOption=SearchOption.TopDirectoryOnly, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 Compile and load all C# source files in a given directory. Using the searchPattern and searchOption parameters, you can control whether nested directories are scanned, as well as filter by file name and extension. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request.
 
ScriptAssembly CompileAndLoadSyntaxTree (CSharpSyntaxTree syntaxTree, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 Compile and load the specified C# syntax tree. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request.
 
ScriptAssembly CompileAndLoadSources (string[] cSharpSources, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 Compile and load the specified C# source code strings. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request.
 
ScriptAssembly CompileAndLoadFiles (string[] cSharpFiles, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 Compile and load the specified C# source files. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request.
 
ScriptAssembly CompileAndLoadSyntaxTrees (CSharpSyntaxTree[] syntaxTrees, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 Compile and load the specified C# syntax tree. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request.
 
ScriptAssembly CompileAndLoadCSharpProject (string cSharpProjectFile, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 Compile and load the specified C# project file (.csproj). Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request.
 
ScriptAssembly CompileAndLoadCSharpProject (CSharpProject cSharpProject, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 Compile and load the specified C# project. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request.
 
AsyncCompileOperation CompileAndLoadSourceAsync (string cSharpSource, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 Compile and load the specified C# source string asynchronously. Use CompileResult of AsyncCompileOperation.CompileDomain to get the output from the compile request. Use SecurityResult of AsyncCompileOperation.CompileDomain to get the output from the code validation request.
 
AsyncCompileOperation CompileAndLoadFileAsync (string cSharpFile, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 Compile and load the specified C# source file asynchronously. Use CompileResult of AsyncCompileOperation.CompileDomain to get the output from the compile request. Use SecurityResult of AsyncCompileOperation.CompileDomain to get the output from the code validation request.
 
AsyncCompileOperation CompileAndLoadSyntaxTreeAsync (CSharpSyntaxTree syntaxTree, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 Compile and load the specified C# syntax tree asynchronously. Use CompileResult of AsyncCompileOperation.CompileDomain to get the output from the compile request. Use SecurityResult of AsyncCompileOperation.CompileDomain to get the output from the code validation request.
 
AsyncCompileOperation CompileAndLoadSourcesAsync (string[] cSharpSources, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 Compile and load the specified C# source strings asynchronously. Use CompileResult of AsyncCompileOperation.CompileDomain to get the output from the compile request. Use SecurityResult of AsyncCompileOperation.CompileDomain to get the output from the code validation request.
 
AsyncCompileOperation CompileAndLoadFilesAsync (string[] cSharpFiles, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 Compile and load the specified C# source files asynchronously. Use CompileResult of AsyncCompileOperation.CompileDomain to get the output from the compile request. Use SecurityResult of AsyncCompileOperation.CompileDomain to get the output from the code validation request.
 
AsyncCompileOperation CompileAndLoadSyntaxTreesAsync (CSharpSyntaxTree[] syntaxTrees, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 Compile and load the specified C# syntax trees asynchronously. Use CompileResult of AsyncCompileOperation.CompileDomain to get the output from the compile request. Use SecurityResult of AsyncCompileOperation.CompileDomain to get the output from the code validation request.
 
void CompileFromSource (string cSharpSource, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 
void CompileFromSources (string[] cSharpSources, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 
void CompileFromFile (string cSharpFile, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 
void CompileFromFiles (string[] cSharpFiles, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 
void CompileFromSyntaxTree (CSharpSyntaxTree syntaxTree, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 
void CompileFromSyntaxTrees (CSharpSyntaxTree[] syntaxTrees, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 
void CompileFromCSharpProject (string cSharpProjectFile, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 
void CompileFromCSharpProject (CSharpProject project, IMetadataReferenceProvider[] additionalReferenceAssemblies=null)
 
void StaticBroadcast (string methodName)
 Attempt to invoke a static method for all types loaded into this domain. Only static method will be considered by this broadcast. Use Broadcast(Scene, string) or BroadcastInstance(Type, string) to broadcast an instance method.
 
void StaticBroadcast (string methodName, params object[] args)
 Attempt to invoke a static method for all types loaded into this domain. Only static method will be considered by this broadcast. Use Broadcast(Scene, string, object[]) or BroadcastInstance(Type, string, object[]) to broadcast an instance method.
 
void BroadcastActiveScene (string methodName)
 Attempt to invoke an instance method for all executing mono bheaivour instances loaded into this domain that exist in the active loaded scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string) if you want to broadcast to non-monobehaviour instances.
 
void BroadcastActiveScene (string methodName, params object[] args)
 Attempt to invoke an instance method for all executing mono bheaivour instances loaded into this domain that exist in the active loaded scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string, object[]) if you want to broadcast to non-monobehaviour instances.
 
void BroadcastActiveScene (Type baseType, string methodName)
 Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in the active loaded scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string) if you want to broadcast to non-monobehaviour instances. Only behaviour types deriving from the specified base type will be considered.
 
void BroadcastActiveScene (Type baseType, string methodName, params object[] args)
 Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in the active loaded scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string, object[]) if you want to broadcast to non-monobehaviour instances. Only behaviour types deriving from the specified base type will be considered.
 
void BroadcastAllScenes (string methodName)
 Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in any loaded scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string) if you want to broadcast to non-monobehaviour instances.
 
void BroadcastAllScenes (string methodName, params object[] args)
 Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in any loaded scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string, object[]) if you want to broadcast to non-monobehaviour instances.
 
void BroadcastAllScenes (Type baseType, string methodName)
 Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in any loaded scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string) if you want to broadcast to non-monobehaviour instances. Only behaviour types deriving from the specified base type will be considered.
 
void BroadcastAllScenes (Type baseType, string methodName, params object[] args)
 Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in any loaded scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string, object[]) if you want to broadcast to non-monobehaviour instances. Only behaviour types deriving from the specified base type will be considered.
 
void Broadcast (Scene targetScene, string methodName)
 Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in the specified scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string, object[]) if you want to broadcast to non-monobehaviour instances.
 
void Broadcast (Scene targetScene, string methodName, params object[] args)
 Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in the specified scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string, object[]) if you want to broadcast to non-monobehaviour instances.
 
void Broadcast (Scene targetScene, Type baseType, string methodName)
 Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in the specified scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string) if you want to broadcast to non-monobehaviour instances. Only behaviour types deriving from the specified base type will be considered.
 
void Broadcast (Scene targetScene, Type baseType, string methodName, params object[] args)
 Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in the specified scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string, object[]) if you want to broadcast to non-monobehaviour instances. Only behaviour types deriving from the specified base type will be considered.
 
void BroadcastInstance (Type baseType, string methodName)
 Attempt to invoke an instance method for all executing non-unity instances (Normal managed instances created using 'new'). Only instances deriving from the specified base type will be considered. Pass 'typeof(object)' to use no filter at all.
 
void BroadcastInstance (Type baseType, string methodName, params object[] args)
 Attempt to invoke an instance method for all executing non-unity instances (Normal managed instances created using 'new'). Only instances deriving from the specified base type will be considered. Pass 'typeof(object)' to use no filter at all.
 
void Dispose ()
 Dispose of this domain. This will cause the target app domain to be unloaded if it is not the default app domain. The domain will be unusable after disposing.
 
void InitializeCompilerService ()
 Initializes the Roslyn compiler service if it has not yet been initialized.
 
void ApplyCompilerServiceSettings ()
 Causes the Roslyn C# settings to be loaded and applied to the Roslyn compiler service. This requires the compiler service to be initialized otherwise it will do nothing.
 
void LogCompilerOutputToConsole ()
 Log the last output of the Roslyn compiler to the Unity console.
 
ScriptAssembly RegisterAssembly (Assembly systemAssembly, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, CompilationResult compileResult=null)
 
ScriptAssembly RegisterAssembly< T > (Assembly systemAssembly, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, CompilationResult compileResult=null)
 
ScriptAssembly RegisterAssemblyPath (Assembly systemAssembly, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, string assemblyPath=null, string assemblySymbolsPath=null, CompilationResult compileResult=null)
 
ScriptAssembly RegisterAssemblyPath< T > (Assembly systemAssembly, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, string assemblyPath=null, string assemblySymbolsPath=null, CompilationResult compileResult=null)
 
ScriptAssembly RegisterAssemblyImage (Assembly systemAssembly, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, byte[] assemblyImage=null, byte[] assemblySymbolsImage=null, CompilationResult compileResult=null)
 
ScriptAssembly RegisterAssemblyImage< T > (Assembly systemAssembly, ScriptSecurityMode securityMode=ScriptSecurityMode.UseSettings, byte[] assemblyImage=null, byte[] assemblySymbolsImage=null, CompilationResult compileResult=null)
 

Static Public Member Functions

static ScriptDomain CreateDomain (string domainName, bool initCompiler=true, bool makeActiveDomain=true, AppDomain sandboxDomain=null)
 Creates a new ScriptDomain into which assemblies and scripts may be loaded.
 
static ScriptDomain FindDomain (string domainName)
 Attempt to find a domain with the specified name.
 
static void MakeDomainActive (ScriptDomain domain)
 Set the specified domain as the active domain. The active domain is used when resolving script types from an unspecified source.
 
static void MakeDomainActive (string domainName)
 Set the domain with the specified name as the active domain. The active domain is used when resolving script types from an unspecified source.
 

Properties

static ScriptDomain Active [get]
 Get the active ScriptDomain. By default the last created domain will be active but you can also make a specific domain active using MakeDomainActive(ScriptDomain).
 
string Name [get]
 Get the name of the domain.
 
AppDomain SandboxDomain [get]
 Get the app domain that this ScriptDomain manages.
 
ScriptExecution Execution [get]
 Get the ScriptExecution for this domain where all executing instances are accessible.
 
ScriptAssembly[] Assemblies [get]
 Get all assemblies loaded into this domain.
 
ScriptAssembly[] CompiledAssemblies [get]
 Get all assemblies loaded into this domain that have been compiled at runtime using the Roslyn runtime compiler service.
 
IEnumerable< ScriptAssemblyEnumerateAssemblies [get]
 Enumerate all assemblies loaded into this domain.
 
IEnumerable< ScriptAssemblyEnumerateCompiledAssemblies [get]
 Enumerate all assemblies loaded into this domain that have been compiled at runtime using the Roslyn runtime compiler service.
 
RoslynCSharpCompiler RoslynCompilerService [get]
 Get the Roslyn runtime compiler service associated with this domain. This value will be null if the compiler service has not been initialized.
 
CompilationResult CompileResult [get]
 Get the last compilation report as a result of compiling an assembly.
 
CodeSecurityReport SecurityResult [get]
 Get the last security report as a result of loading or compiling an assembly.
 
bool IsCompilerServiceInitialized [get]
 Returns true if the Roslyn compiler service is initialized and ready to recieve compile requests.
 
bool IsDisposed [get]
 Has this domain been disposed.
 

Detailed Description

A ScriptDomain acts as a container for all code that is loaded dynamically at runtime. The main responsiblility of the domin is to separate pre-compiled game code from runtime-loaded code. As a result, you will only be able to access types from the domain that were loaded at runtime. Any pre-compiled game code will be ignored. Any assemblies or scripts that are loaded into the domain at runtime will remain until the application exits so you should be careful to avoid loading too many assemblies. You would typically load user code at statup in a 'Load' method which would then exist and execute until the game exits. Multiple domain instances may be created but you should note that all runtime code will be loaded into the current application domain. The ScriptDomain simply masks the types that are visible.

Member Function Documentation

◆ Broadcast() [1/4]

void RoslynCSharp.ScriptDomain.Broadcast ( Scene  targetScene,
string  methodName 
)
inline

Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in the specified scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string, object[]) if you want to broadcast to non-monobehaviour instances.

Parameters
targetSceneThe scene used to filter the broadcast. All executing behaviour instances in this scene matching the criteria will receive the broadcast
methodNameThe name of the method to invoke
argsThe argument list for the target method. All matching instances must have a compatible argument list otherwise the broadcast will fail for that particular instance

◆ Broadcast() [2/4]

void RoslynCSharp.ScriptDomain.Broadcast ( Scene  targetScene,
string  methodName,
params object[]  args 
)
inline

Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in the specified scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string, object[]) if you want to broadcast to non-monobehaviour instances.

Parameters
targetSceneThe scene used to filter the broadcast. All executing behaviour instances in this scene matching the criteria will receive the broadcast
methodNameThe name of the method to invoke
argsThe argument list for the target method. All matching instances must have a compatible argument list otherwise the broadcast will fail for that particular instance

◆ Broadcast() [3/4]

void RoslynCSharp.ScriptDomain.Broadcast ( Scene  targetScene,
Type  baseType,
string  methodName 
)
inline

Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in the specified scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string) if you want to broadcast to non-monobehaviour instances. Only behaviour types deriving from the specified base type will be considered.

Parameters
targetSceneThe scene used to filter the broadcast. All executing behaviour instances in this scene matching the criteria will receive the broadcast
baseTypeA type deriving from monobehaviour that executing types must inherit from in order to receive the broadcast
methodNameThe name of the method to invoke

◆ Broadcast() [4/4]

void RoslynCSharp.ScriptDomain.Broadcast ( Scene  targetScene,
Type  baseType,
string  methodName,
params object[]  args 
)
inline

Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in the specified scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string, object[]) if you want to broadcast to non-monobehaviour instances. Only behaviour types deriving from the specified base type will be considered.

Parameters
targetSceneThe scene used to filter the broadcast. All executing behaviour instances in this scene matching the criteria will receive the broadcast
baseTypeA type deriving from monobehaviour that executing types must inherit from in order to receive the broadcast
methodNameThe name of the method to invoke
argsThe argument list for the target method. All matching instances must have a compatible argument list otherwise the broadcast will fail for that particular instance

◆ BroadcastActiveScene() [1/4]

void RoslynCSharp.ScriptDomain.BroadcastActiveScene ( string  methodName)
inline

Attempt to invoke an instance method for all executing mono bheaivour instances loaded into this domain that exist in the active loaded scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string) if you want to broadcast to non-monobehaviour instances.

Parameters
methodNameThe name of the method to invoke

◆ BroadcastActiveScene() [2/4]

void RoslynCSharp.ScriptDomain.BroadcastActiveScene ( string  methodName,
params object[]  args 
)
inline

Attempt to invoke an instance method for all executing mono bheaivour instances loaded into this domain that exist in the active loaded scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string, object[]) if you want to broadcast to non-monobehaviour instances.

Parameters
methodNameThe name of the method to invoke
argsThe argument list for the target method. All matching instances must have a compatible argument list otherwise the broadcast will fail for that particular instance

◆ BroadcastActiveScene() [3/4]

void RoslynCSharp.ScriptDomain.BroadcastActiveScene ( Type  baseType,
string  methodName 
)
inline

Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in the active loaded scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string) if you want to broadcast to non-monobehaviour instances. Only behaviour types deriving from the specified base type will be considered.

Parameters
baseTypeA type deriving from monobehaviour that executing types must inherit from in order to receive the broadcast
methodNameThe name of the method to invoke

◆ BroadcastActiveScene() [4/4]

void RoslynCSharp.ScriptDomain.BroadcastActiveScene ( Type  baseType,
string  methodName,
params object[]  args 
)
inline

Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in the active loaded scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string, object[]) if you want to broadcast to non-monobehaviour instances. Only behaviour types deriving from the specified base type will be considered.

Parameters
baseTypeA type deriving from monobehaviour that executing types must inherit from in order to receive the broadcast
methodNameThe name of the method to invoke
argsThe argument list for the target method. All matching instances must have a compatible argument list otherwise the broadcast will fail for that particular instance

◆ BroadcastAllScenes() [1/4]

void RoslynCSharp.ScriptDomain.BroadcastAllScenes ( string  methodName)
inline

Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in any loaded scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string) if you want to broadcast to non-monobehaviour instances.

Parameters
methodNameThe name of the method to invoke

◆ BroadcastAllScenes() [2/4]

void RoslynCSharp.ScriptDomain.BroadcastAllScenes ( string  methodName,
params object[]  args 
)
inline

Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in any loaded scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string, object[]) if you want to broadcast to non-monobehaviour instances.

Parameters
methodNameThe name of the method to invoke
argsThe argument list for the target method. All matching instances must have a compatible argument list otherwise the broadcast will fail for that particular instance

◆ BroadcastAllScenes() [3/4]

void RoslynCSharp.ScriptDomain.BroadcastAllScenes ( Type  baseType,
string  methodName 
)
inline

Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in any loaded scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string) if you want to broadcast to non-monobehaviour instances. Only behaviour types deriving from the specified base type will be considered.

Parameters
baseTypeA type deriving from monobehaviour that executing types must inherit from in order to receive the broadcast
methodNameThe name of the method to invoke

◆ BroadcastAllScenes() [4/4]

void RoslynCSharp.ScriptDomain.BroadcastAllScenes ( Type  baseType,
string  methodName,
params object[]  args 
)
inline

Attempt to invoke an instance method for all executing mono behaviour instances loaded into this domain that exist in any loaded scene. Only monobehaviour components will be considered by this broadcast. Use BroadcastInstance(Type, string, object[]) if you want to broadcast to non-monobehaviour instances. Only behaviour types deriving from the specified base type will be considered.

Parameters
baseTypeA type deriving from monobehaviour that executing types must inherit from in order to receive the broadcast
methodNameThe name of the method to invoke
argsThe argument list for the target method. All matching instances must have a compatible argument list otherwise the broadcast will fail for that particular instance

◆ BroadcastInstance() [1/2]

void RoslynCSharp.ScriptDomain.BroadcastInstance ( Type  baseType,
string  methodName 
)
inline

Attempt to invoke an instance method for all executing non-unity instances (Normal managed instances created using 'new'). Only instances deriving from the specified base type will be considered. Pass 'typeof(object)' to use no filter at all.

Parameters
baseTypeA type that executing types must inherit from in order to receive the broadcast
methodNameThe name of the method to invoke

◆ BroadcastInstance() [2/2]

void RoslynCSharp.ScriptDomain.BroadcastInstance ( Type  baseType,
string  methodName,
params object[]  args 
)
inline

Attempt to invoke an instance method for all executing non-unity instances (Normal managed instances created using 'new'). Only instances deriving from the specified base type will be considered. Pass 'typeof(object)' to use no filter at all.

Parameters
baseTypeA type that executing types must inherit from in order to receive the broadcast
methodNameThe name of the method to invoke
argsThe argument list for the target method. All matching instances must have a compatible argument list otherwise the broadcast will fail for that particular instance

◆ CompileAndLoadCSharpProject() [1/2]

ScriptAssembly RoslynCSharp.ScriptDomain.CompileAndLoadCSharpProject ( CSharpProject  cSharpProject,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
IMetadataReferenceProvider[]  additionalReferenceAssemblies = null 
)
inline

Compile and load the specified C# project. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request.

Parameters
cSharpProjectThe CSharpProject to compile
securityModeThe code validation used to verify the code
Returns
The compiled and loaded assembly or null if the compile or security verification failed

◆ CompileAndLoadCSharpProject() [2/2]

ScriptAssembly RoslynCSharp.ScriptDomain.CompileAndLoadCSharpProject ( string  cSharpProjectFile,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
IMetadataReferenceProvider[]  additionalReferenceAssemblies = null 
)
inline

Compile and load the specified C# project file (.csproj). Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request.

Parameters
cSharpProjectFileA file path to the .csproj file to compile
securityModeThe code validation used to verify the code
Returns
The compiled and loaded assembly or null if the compile or security verification failed

◆ CompileAndLoadDirectory()

ScriptAssembly RoslynCSharp.ScriptDomain.CompileAndLoadDirectory ( string  directoryPath,
string  searchPattern = "*.cs",
SearchOption  searchOption = SearchOption::TopDirectoryOnly,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
IMetadataReferenceProvider[]  additionalReferenceAssemblies = null 
)
inline

Compile and load all C# source files in a given directory. Using the searchPattern and searchOption parameters, you can control whether nested directories are scanned, as well as filter by file name and extension. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request.

Parameters
directoryPathThe directory path to scan
searchPatternThe file matching filter used to find source files inside the given directory. The default option '*.cs' should be fine in most cases for finding .cs source files
searchOptionSpecify whether top level or nested directories should be scanned
securityModeThe code validation used to verify the code
additionalReferenceAssemblies
Returns
The compiled and loaded assembly or null if the compile or security verification failed

◆ CompileAndLoadFile()

ScriptAssembly RoslynCSharp.ScriptDomain.CompileAndLoadFile ( string  cSharpFile,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
IMetadataReferenceProvider[]  additionalReferenceAssemblies = null 
)
inline

Compile and load the specified C# source file. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request.

Parameters
cSharpFileThe filepath to a file containing C# code
securityModeThe code validation used to verify the code
Returns
The compiled and loaded assembly or null if the compile or security verification failed

◆ CompileAndLoadFileAsync()

AsyncCompileOperation RoslynCSharp.ScriptDomain.CompileAndLoadFileAsync ( string  cSharpFile,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
IMetadataReferenceProvider[]  additionalReferenceAssemblies = null 
)
inline

Compile and load the specified C# source file asynchronously. Use CompileResult of AsyncCompileOperation.CompileDomain to get the output from the compile request. Use SecurityResult of AsyncCompileOperation.CompileDomain to get the output from the code validation request.

Parameters
cSharpFileThe filepath to the C# source file
securityModeThe code validation used to verify the code
Returns
An awaitable async operation object containing state information about the compile request

◆ CompileAndLoadFiles()

ScriptAssembly RoslynCSharp.ScriptDomain.CompileAndLoadFiles ( string[]  cSharpFiles,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
IMetadataReferenceProvider[]  additionalReferenceAssemblies = null 
)
inline

Compile and load the specified C# source files. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request.

Parameters
cSharpFilesAn array of filepaths to C# source files
securityModeThe code validation used to verify the code
Returns
The compiled and loaded assembly or null if the compil or security verification failed

◆ CompileAndLoadFilesAsync()

AsyncCompileOperation RoslynCSharp.ScriptDomain.CompileAndLoadFilesAsync ( string[]  cSharpFiles,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
IMetadataReferenceProvider[]  additionalReferenceAssemblies = null 
)
inline

Compile and load the specified C# source files asynchronously. Use CompileResult of AsyncCompileOperation.CompileDomain to get the output from the compile request. Use SecurityResult of AsyncCompileOperation.CompileDomain to get the output from the code validation request.

Parameters
cSharpFilesAn array of filepaths to C# source files
securityModeThe code validation used to verify the code
Returns
An awaitable async operation object containing state information about the compile request

◆ CompileAndLoadMainFile()

ScriptType RoslynCSharp.ScriptDomain.CompileAndLoadMainFile ( string  cSharpFile,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
IMetadataReferenceProvider[]  additionalReferenceAssemblies = null 
)
inline

Compile and load the specified C# source file. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request. This does the same as CompileAndLoadFileAsync(string, ScriptSecurityMode) but returns the main type of the ScriptAssembly for convenience.

Parameters
cSharpFileThe filepath to a file containing C# code
securityModeThe code validation used to verify the code
Returns
The main type of the compiled assembly or null if the compile failed, security validation failed or there was no main type

◆ CompileAndLoadMainSource()

ScriptType RoslynCSharp.ScriptDomain.CompileAndLoadMainSource ( string  cSharpSource,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
IMetadataReferenceProvider[]  additionalReferenceAssemblies = null 
)
inline

Compile and load the speciied C# source code string. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request. This does the same as CompileAndLoadSource(string, ScriptSecurityMode) but returns the main type of the ScriptAssembly for convenience. ///.

Parameters
cSharpSourceThe string containing C# source code
securityModeThe code validation used to verify the code
Returns
The main type of the compiled assembly or null if the compile failed, security validation failed or there was main type

◆ CompileAndLoadMainSyntaxTree()

ScriptType RoslynCSharp.ScriptDomain.CompileAndLoadMainSyntaxTree ( CSharpSyntaxTree  syntaxTree,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
IMetadataReferenceProvider[]  additionalReferenceAssemblies = null 
)
inline

Compile and load the specified C# syntax tree. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request. This does the same as CompileAndLoadSyntaxTree(CSharpSyntaxTree, ScriptSecurityMode, IMetadataReferenceProvider[]) but returns the main type of the ScriptAssembly for convenience.

Parameters
cSharpFileThe C# syntax tree to compile
securityModeThe code validation used to verify the code
Returns
The main type of the compiled assembly or null if the compile failed, security validation failed or there was no main type

◆ CompileAndLoadSource()

ScriptAssembly RoslynCSharp.ScriptDomain.CompileAndLoadSource ( string  cSharpSource,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
IMetadataReferenceProvider[]  additionalReferenceAssemblies = null 
)
inline

Compile and load the specified C# source code string. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request.

Parameters
cSharpSourceThe string containing C# source code
securityModeThe code validation used to verify the code
Returns
The compiled and loaded assembly or null if the compile or security verification failed

◆ CompileAndLoadSourceAsync()

AsyncCompileOperation RoslynCSharp.ScriptDomain.CompileAndLoadSourceAsync ( string  cSharpSource,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
IMetadataReferenceProvider[]  additionalReferenceAssemblies = null 
)
inline

Compile and load the specified C# source string asynchronously. Use CompileResult of AsyncCompileOperation.CompileDomain to get the output from the compile request. Use SecurityResult of AsyncCompileOperation.CompileDomain to get the output from the code validation request.

Parameters
cSharpSourceThe string containing C# source code
securityModeThe code validation used to verify the code
Returns
An awaitable async operation object containing state information about the compile request

◆ CompileAndLoadSources()

ScriptAssembly RoslynCSharp.ScriptDomain.CompileAndLoadSources ( string[]  cSharpSources,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
IMetadataReferenceProvider[]  additionalReferenceAssemblies = null 
)
inline

Compile and load the specified C# source code strings. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request.

Parameters
cSharpSourcesAn array of C# source code strings
securityModeThe code validation used to verify the code
Returns
The compiled and loaded assembly or null if the compile or security verification failed

◆ CompileAndLoadSourcesAsync()

AsyncCompileOperation RoslynCSharp.ScriptDomain.CompileAndLoadSourcesAsync ( string[]  cSharpSources,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
IMetadataReferenceProvider[]  additionalReferenceAssemblies = null 
)
inline

Compile and load the specified C# source strings asynchronously. Use CompileResult of AsyncCompileOperation.CompileDomain to get the output from the compile request. Use SecurityResult of AsyncCompileOperation.CompileDomain to get the output from the code validation request.

Parameters
cSharpSourcesAn array of strings containgin C# source code
securityModeThe code validation used to verify the code
Returns
An awaitable async operation object containing state infomration about the compile request

◆ CompileAndLoadSyntaxTree()

ScriptAssembly RoslynCSharp.ScriptDomain.CompileAndLoadSyntaxTree ( CSharpSyntaxTree  syntaxTree,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
IMetadataReferenceProvider[]  additionalReferenceAssemblies = null 
)
inline

Compile and load the specified C# syntax tree. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request.

Parameters
cSharpFileThe C# syntax tree to compile
securityModeThe code validation used to verify the code
Returns
The compiled and loaded assembly or null if the compile or security verification failed

◆ CompileAndLoadSyntaxTreeAsync()

AsyncCompileOperation RoslynCSharp.ScriptDomain.CompileAndLoadSyntaxTreeAsync ( CSharpSyntaxTree  syntaxTree,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
IMetadataReferenceProvider[]  additionalReferenceAssemblies = null 
)
inline

Compile and load the specified C# syntax tree asynchronously. Use CompileResult of AsyncCompileOperation.CompileDomain to get the output from the compile request. Use SecurityResult of AsyncCompileOperation.CompileDomain to get the output from the code validation request.

Parameters
syntaxTreeThe C# syntax tree to compilee
securityModeThe code validation used to verify the code
Returns
An awaitable async operation object containing state information about the compile request

◆ CompileAndLoadSyntaxTrees()

ScriptAssembly RoslynCSharp.ScriptDomain.CompileAndLoadSyntaxTrees ( CSharpSyntaxTree[]  syntaxTrees,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
IMetadataReferenceProvider[]  additionalReferenceAssemblies = null 
)
inline

Compile and load the specified C# syntax tree. Use CompileResult to get the output from the compile request. Use SecurityResult to get the output from the code validation request.

Parameters
syntaxTreesAn array of CSharp syntax trees
securityModeThe code validation used to verify the code
Returns
The compiled and loaded assembly or null if the compile or security verification failed

◆ CompileAndLoadSyntaxTreesAsync()

AsyncCompileOperation RoslynCSharp.ScriptDomain.CompileAndLoadSyntaxTreesAsync ( CSharpSyntaxTree[]  syntaxTrees,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
IMetadataReferenceProvider[]  additionalReferenceAssemblies = null 
)
inline

Compile and load the specified C# syntax trees asynchronously. Use CompileResult of AsyncCompileOperation.CompileDomain to get the output from the compile request. Use SecurityResult of AsyncCompileOperation.CompileDomain to get the output from the code validation request.

Parameters
syntaxTreesAn array of C# syntax trees to compile
securityModeThe code validation used to verify the code
Returns
An awaitable async operation object containing state information about the compile request

◆ CreateDomain()

static ScriptDomain RoslynCSharp.ScriptDomain.CreateDomain ( string  domainName,
bool  initCompiler = true,
bool  makeActiveDomain = true,
AppDomain  sandboxDomain = null 
)
inlinestatic

Creates a new ScriptDomain into which assemblies and scripts may be loaded.

Returns
A new instance of ScriptDomain

◆ FindDomain()

static ScriptDomain RoslynCSharp.ScriptDomain.FindDomain ( string  domainName)
inlinestatic

Attempt to find a domain with the specified name.

Parameters
domainNameThe domain name to search for
Returns
A domain with the specified name or null if no matching domain was found

◆ LoadAssembly() [1/3]

ScriptAssembly RoslynCSharp.ScriptDomain.LoadAssembly ( AssemblyName  name,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings 
)
inline

Attempts to load the specified managed assembly into the sandbox app domain. Use SecurityResult to get the output from the code validation request.

Parameters
nameThe AssemblyName representing the assembly to load
securityModeThe security mode which determines whether code validation will run
Returns
An instance of ScriptAssembly representing the loaded assembly or null if an error occurs

◆ LoadAssembly() [2/3]

ScriptAssembly RoslynCSharp.ScriptDomain.LoadAssembly ( byte[]  assemblyBytes,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings 
)
inline

Attempts to load a managed assembly from the specified raw bytes. Use SecurityResult to get the output from the code validation request.

Parameters
assemblyBytesThe raw data representing the file structure of the managed assembly, The result of File.ReadAllBytes(string) for example.
Returns
An instance of ScriptAssembly representing the loaded assembly or null if an error occurs
Parameters
securityModeThe security mode which determines whether code validation will run

◆ LoadAssembly() [3/3]

ScriptAssembly RoslynCSharp.ScriptDomain.LoadAssembly ( string  fullPath,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings 
)
inline

Attempts to load the specified managed assembly into the sandbox app domain. Use SecurityResult to get the output from the code validation request.

Parameters
fullPathThe full path to the .dll file
securityModeThe security mode which determines whether code validation will run
Returns
An instance of ScriptAssembly representing the loaded assembly or null if an error occurs

◆ LoadAssemblyAsync() [1/3]

AsyncLoadOperation RoslynCSharp.ScriptDomain.LoadAssemblyAsync ( AssemblyName  name,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings 
)
inline

Attempts to load a managed assembly with the specified name asynchronously. Use SecurityResult of AsyncLoadOperation.LoadDomain to get the output from the code validation request.

Parameters
nameThe name of the assembly to load
securityModeThe security mode which determines whether code validation will run
Returns
An awaitable async operation object that contains state information for the load request

◆ LoadAssemblyAsync() [2/3]

AsyncLoadOperation RoslynCSharp.ScriptDomain.LoadAssemblyAsync ( byte[]  assemblyBytes,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings 
)
inline

Attempts to load a managed assembly from the specified raw bytes asynchronously. Use SecurityResult of AsyncLoadOperation.LoadDomain to get the output from the code validation request.

Parameters
assemblyBytesA byte array containing the managed assembly imagae data
securityModeThe security mode which determines whether code validation will run
Returns
An awaitable async operation object that contains state information for the load request

◆ LoadAssemblyAsync() [3/3]

AsyncLoadOperation RoslynCSharp.ScriptDomain.LoadAssemblyAsync ( string  fullPath,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings 
)
inline

Attempts to load a managed assembly from the specified filepath asynchronously. Use SecurityResult of AsyncLoadOperation.LoadDomain to get the output from the code validation request.

Parameters
fullPathThe filepath to the managed assembly
securityModeThe security mode which determines whether code validation will run
Returns
An awaitable async operation object that contains state information for the load request

◆ LoadAssemblyFromResources()

ScriptAssembly RoslynCSharp.ScriptDomain.LoadAssemblyFromResources ( string  resourcePath,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings 
)
inline

Attempts to load a managed assembly from the specified resources path into the sandbox app domain. The target asset must be a TextAsset in order to be loaded successfully. Use SecurityResult to get the output from the code validation request.

Parameters
resourcePathThe file name of path relative to the 'Resources' folder without the file extension
securityModeThe security mode which determines whether code validation will run
Returns
An instance of ScriptAssembly representing the loaded assembly or null if an error occurs
Exceptions
SecurityExceptionThe assembly breaches the imposed security restrictions

◆ LoadAssemblyWithSymbols() [1/2]

ScriptAssembly RoslynCSharp.ScriptDomain.LoadAssemblyWithSymbols ( byte[]  assemblyBytes,
byte[]  symbolBytes,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings 
)
inline

Attempts to load a managed assembly from the specified raw bytes along with debug symbols. Use this method if you want to be able to debug the specified assembly. Use SecurityResult to get the output from the code validation request.

Parameters
assemblyBytesThe raw data representing the file structure of the managed assembly, The result of File.ReadAllBytes(string) for example.
symbolBytesThe raw data representing the pdb debug symbols for the managed assembly
Returns
An instance of ScriptAssembly representing the loaded assembly or null if an error occurs
Parameters
securityModeThe security mode which determines whether code validation will run

◆ LoadAssemblyWithSymbols() [2/2]

ScriptAssembly RoslynCSharp.ScriptDomain.LoadAssemblyWithSymbols ( string  assemblyPath,
string  symbolsPath,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings 
)
inline

Attempts to load the specified managed assembly into the sandbox app domain along with pdb debug symbols. Use this method if you want to be able to debug the specified assembly. Use SecurityResult to get the output from the code validation request.

Parameters
assemblyPathThe full path to the .dll file
symbolsPathThe full path to the .pdb symbols file
securityModeThe security mode which determines whether code validation will run
Returns
An instance of ScriptAssembly representing the loaded assembly or null if an error occurs

◆ LoadAssemblyWithSymbolsAsync() [1/2]

AsyncLoadOperation RoslynCSharp.ScriptDomain.LoadAssemblyWithSymbolsAsync ( byte[]  assemblyBytes,
byte[]  symbolBytes,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings 
)
inline

Attempts to load a managed assembly from the specified raw bytes asynchronously. Use SecurityResult of AsyncLoadOperation.LoadDomain to get the output from the code validation request. Use this method if you want to be able to debug the specified assembly.

Parameters
assemblyBytesA byte array containing the managed assembly imagae data
symbolBytesA byte array containing the raw assembly pdb debug symbol image data
securityModeThe security mode which determines whether code validation will run
Returns
An awaitable async operation object that contains state information for the load request

◆ LoadAssemblyWithSymbolsAsync() [2/2]

AsyncLoadOperation RoslynCSharp.ScriptDomain.LoadAssemblyWithSymbolsAsync ( string  assemblyPath,
string  symbolsPath,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings 
)
inline

Attempts to load a managed assembly from the specified filepath asynchronously. Use this method if you want to be able to debug the specified assembly. Use SecurityResult of AsyncLoadOperation.LoadDomain to get the output from the code validation request.

Parameters
assemblyPathThe filepath to the managed assembly
symbolsPathThe filepath for the pdb debug symbols
securityModeThe security mode which determines whether code validation will run
Returns
An awaitable async operation object that contains state information for the load request

◆ MakeDomainActive() [1/2]

static void RoslynCSharp.ScriptDomain.MakeDomainActive ( ScriptDomain  domain)
inlinestatic

Set the specified domain as the active domain. The active domain is used when resolving script types from an unspecified source.

Parameters
domainThe domain to make active

◆ MakeDomainActive() [2/2]

static void RoslynCSharp.ScriptDomain.MakeDomainActive ( string  domainName)
inlinestatic

Set the domain with the specified name as the active domain. The active domain is used when resolving script types from an unspecified source.

Parameters
domainNameThe name of the domain to make active

◆ RegisterAssembly< T >()

ScriptAssembly RoslynCSharp.ScriptDomain.RegisterAssembly< T > ( Assembly  systemAssembly,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
CompilationResult  compileResult = null 
)
inline
Type Constraints
T :ScriptAssembly 
T :new() 

◆ RegisterAssemblyImage< T >()

ScriptAssembly RoslynCSharp.ScriptDomain.RegisterAssemblyImage< T > ( Assembly  systemAssembly,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
byte[]  assemblyImage = null,
byte[]  assemblySymbolsImage = null,
CompilationResult  compileResult = null 
)
inline
Type Constraints
T :ScriptAssembly 
T :new() 

◆ RegisterAssemblyPath< T >()

ScriptAssembly RoslynCSharp.ScriptDomain.RegisterAssemblyPath< T > ( Assembly  systemAssembly,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings,
string  assemblyPath = null,
string  assemblySymbolsPath = null,
CompilationResult  compileResult = null 
)
inline
Type Constraints
T :ScriptAssembly 
T :new() 

◆ StaticBroadcast() [1/2]

void RoslynCSharp.ScriptDomain.StaticBroadcast ( string  methodName)
inline

Attempt to invoke a static method for all types loaded into this domain. Only static method will be considered by this broadcast. Use Broadcast(Scene, string) or BroadcastInstance(Type, string) to broadcast an instance method.

Parameters
methodNameThe nake of the static method to invoke

◆ StaticBroadcast() [2/2]

void RoslynCSharp.ScriptDomain.StaticBroadcast ( string  methodName,
params object[]  args 
)
inline

Attempt to invoke a static method for all types loaded into this domain. Only static method will be considered by this broadcast. Use Broadcast(Scene, string, object[]) or BroadcastInstance(Type, string, object[]) to broadcast an instance method.

Parameters
methodNameThe nake of the static method to invoke
argsThe argument list for the target method. All matching static methods must have a compatible argument list otherwise the broadcast will fail for that particular call

◆ TryLoadAssembly() [1/3]

bool RoslynCSharp.ScriptDomain.TryLoadAssembly ( AssemblyName  name,
out ScriptAssembly  result,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings 
)
inline

Attempts to load a managed assembly with the specified name. Any exceptions thrown while loading will be caught.

Parameters
nameThe AssemblyName of the assembly to load
resultAn instance of ScriptAssembly representing the loaded assembly or null if the load failed
securityModeThe security mode which determines whether code validation will run
Returns
True if the assembly was loaded successfully or false if an error occurred

◆ TryLoadAssembly() [2/3]

bool RoslynCSharp.ScriptDomain.TryLoadAssembly ( byte[]  data,
out ScriptAssembly  result,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings 
)
inline

Attempts to load a managed assembly from the raw assembly data. Any exceptions thrown while loading will be caught.

Parameters
dataThe raw data representing the file structure of the managed assembly, The result of File.ReadAllBytes(string) for example.
resultAn instance of ScriptAssembly representing the loaded assembly or null if the load failed
securityModeThe security mode which determines whether code validation will run
Returns
True if the assembly was loaded successfully or false if an error occured

◆ TryLoadAssembly() [3/3]

bool RoslynCSharp.ScriptDomain.TryLoadAssembly ( string  fullPath,
out ScriptAssembly  result,
ScriptSecurityMode  securityMode = ScriptSecurityMode::UseSettings 
)
inline

Attempts to load the managed assembly at the specified location. Any exceptions throw while loading will be caught.

Parameters
fullPathThe full path to the .dll file
resultAn instance of ScriptAssembly representing the loaded assembly or null if the load failed
securityModeThe security mode which determines whether code validation will run
Returns
True if the assembly was loaded successfully or false if an error occurred

The documentation for this class was generated from the following file: