Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Assembly

Creates an assembly with the default compiler options.
Read time 2 minutesLast updated 3 hours ago

Definition

Assembly(string, string, string[], string[], Assembly[], string[], AssemblyFlags)

Creates an assembly with the default compiler options.
public Assembly(string name, string outputPath, string[] sourceFiles, string[] defines, Assembly[] assemblyReferences, string[] compiledAssemblyReferences, AssemblyFlags flags)

Parameters

name

The name of the assembly.

outputPath

The full file path to write the compiled assembly to.

sourceFiles

The paths of the script files to compile into the assembly.

defines

The scripting symbols to define when compiling the assembly.

assemblyReferences

The assemblies compiled by Unity that this assembly references.

compiledAssemblyReferences

The file paths of precompiled assemblies that this assembly references.

Flags that describe the assembly, for example whether it's an Editor assembly. For more information, refer to AssemblyFlags.

Remarks

The assembly uses the default ScriptCompilerOptions and has an empty root namespace. To set either, use one of the other constructors.

Assembly(string, string, string[], string[], Assembly[], string[], AssemblyFlags, ScriptCompilerOptions)

Creates an assembly with the specified compiler options.
public Assembly(string name, string outputPath, string[] sourceFiles, string[] defines, Assembly[] assemblyReferences, string[] compiledAssemblyReferences, AssemblyFlags flags, ScriptCompilerOptions compilerOptions)

Parameters

name

The name of the assembly.

outputPath

The full file path to write the compiled assembly to.

sourceFiles

The paths of the script files to compile into the assembly.

defines

The scripting symbols to define when compiling the assembly.

assemblyReferences

The assemblies compiled by Unity that this assembly references.

compiledAssemblyReferences

The file paths of precompiled assemblies that this assembly references.

Flags that describe the assembly, for example whether it's an Editor assembly. For more information, refer to AssemblyFlags.

compilerOptions

The options to pass to the compiler, such as whether to allow unsafe code, the code optimization mode, and the API compatibility level. For more information, refer to ScriptCompilerOptions.

Remarks

The assembly has an empty root namespace. To set a root namespace, use the constructor that takes
rootNamespace
.

Assembly(string, string, string[], string[], Assembly[], string[], AssemblyFlags, ScriptCompilerOptions, string)

Creates an assembly with the specified compiler options and root namespace.
public Assembly(string name, string outputPath, string[] sourceFiles, string[] defines, Assembly[] assemblyReferences, string[] compiledAssemblyReferences, AssemblyFlags flags, ScriptCompilerOptions compilerOptions, string rootNamespace)

Parameters

name

The name of the assembly.

outputPath

The full file path to write the compiled assembly to.

sourceFiles

The paths of the script files to compile into the assembly.

defines

The scripting symbols to define when compiling the assembly.

assemblyReferences

The assemblies compiled by Unity that this assembly references.

compiledAssemblyReferences

The file paths of precompiled assemblies that this assembly references.

Flags that describe the assembly, for example whether it's an Editor assembly. For more information, refer to AssemblyFlags.

compilerOptions

The options to pass to the compiler, such as whether to allow unsafe code, the code optimization mode, and the API compatibility level. For more information, refer to ScriptCompilerOptions.

rootNamespace

The root namespace that the scripts in the assembly belong to.