Version: 2019.4
Assembly Definitions
Managed code stripping

Assembly Definition properties

Click on an Assembly Definition Asset to set the properties for an assembly in the Inspector window.

Assembly Definition Inspector
Assembly Definition Inspector
Property Description
Имя The name for the assembly (without a file extension). Assembly names must be unique across the Project. Consider using a reverse-DNS naming style, especially if you want to use the assembly in more than one Project. Note: Unity uses the name you assign to the Assembly Definition Asset as the default value of the Name field, but you can change the name as desired.
General
Allow ‘unsafe’ code Enable the Allow ‘unsafe’ Code option if you have used the C# /unsafe keyword in a script within the assembly. When you enable this setting, Unity passes the /unsafe option to the C# compiler when it compiles the assembly.
Auto Referenced Specify whether all predefined assemblies should reference this Project assembly. When you enable this property, the predefined assemblies reference all assemblies defined in the Project, which matches how predefined assemblies reference precompiled assemblies (plug-ins).

When you disable the Auto Reference setting on a file, Unity does not automatically reference the file during compilation. This has no effect on whether Unity includes it in the build. You can control the Build Settings for plug-ins in Platform Settings.
Override References Enable the Override References setting to manually specify which precompiled assemblies this assembly depends upon. When you enable Override References, the Inspector shows the Assembly References section, which you can use to specify the references.

A precompiled assembly is a library compiled outside your Unity Project. By default, assemblies you define in your Project reference all the precompiled assemblies you add to the Project, which matches how the predefined assemblies reference all precompiled assemblies. When you enable Override References, this assembly only references the precompiled assemblies you add under Assembly References.

Note: To prevent Project assemblies from automatically referencing a precompiled assembly, you can disable its Auto Referenced option. See Plugin Inspector for more information.
No Engine References When you enable this property, Unity does not add references to UnityEditor or UnityEngine when it compiles the assembly.
Define Constraints Specify the compiler #define directives that must be defined for Unity to compile or reference an assembly.

Unity only compiles and references a Project assembly if all of the Define Constraints are satisfied. Constraints work like the #if preprocessor directive in C#, but on the assembly level instead of the script level. You must define all the symbols in the Define Constraints setting for the constraints to be satisfied.

To specify that a symbol must be undefined, prefix it with a negating ! (bang) symbol. For example, if you specify the following symbols as the Define Constraints:

!ENABLE_IL2CPP
UNITY_2018_3_OR_NEWER

The constraints are satisfied when the symbol ENABLE_IL2CPP is not defined and the symbol UNITY_2018_3_OR_NEWER is defined. In other words, Unity only compiles and references this assembly on non-IL2CPP scripting runtimes for Unity 2018.3 or newer.

You can use the || (OR) operator to specify that at least one of the constraints must be present in order for the constraints to be satisfied. For example:

UNITY_IOS || UNITY_EDITOR_OSX
UNITY_2019_3_OR_NEWER
!UNITY_ANDROID

The constraints are satisfied when either UNITY_IOS or UNITY_EDITOR_OSX and UNITY_2019_3_OR_NEWER are defined and UNITY_ANDROID is not defined. Individual lines are analogous to performing a logical AND between the constraints in them. The above example is eequivalent to (UNITY_IOS OR UNITY_EDITOR_OSX) AND (UNITY_2019_3_OR_NEWER) AND (NOT UNITY_ANDROID).

You can use any of Unity’s built-in #define directives or any symbols defined in the Project’s Scripting Define Symbols Player setting. See Platform dependent compilation for more information, including a list of the built-in symbols. Note" The Scripting Define Symbols settings are platform-specific. If you use this setting to define whether Unity should use an assembly, make sure that you define the necessary symbols on all of the relevant platforms.
Assembly Definition References Specify references to other assemblies that you have created using Assembly Definition Assets.

Unity uses these references to compile the assembly and also define the dependencies between assemblies.
Use GUIDs This setting controls how Unity serializes references to other Assembly Definition Assets. When you enable this property, Unity saves the reference as the Asset’s GUID, instead of the Assembly Definition name. It’s good practice to use the GUID instead of the name, because it means you can make changes to the name of an Assembly Definition Asset without having to update other Assembly Definition files that reference it.
Assembly References Only appears if you enable the Override References property. Use this area to specify any references to precompiled assemblies on which this assembly depends.
Platforms Set the platform compatibility of the assembly. Unity only compiles or references this assembly on the included (or not excluded) platforms.
Version Defines Specify which versions of a package and modules to include in compilations.
Assembly Definitions
Managed code stripping