Assembly Definition and Assembly Definition Reference assets are JSON files. You can edit the asset files inside the Unity Editor using the InspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
See in Glossary window, but you can also modify the JSON content with an external tool.
An Assembly Definition is a JSON object with the following fields:
Optional. Defaults to false. See Allow ‘unsafe’ Code.
"allowUnsafeCode" : true
Optional. Defaults to true. See Auto Referenced.
"autoReferenced": false
Optional. The symbols that serve as constraints. Can be empty. See Define Constraints.
"defineConstraints": [
"UNITY_2019",
"UNITY_INCLUDE_TESTS"
]
Optional. The platform name strings to exclude or an empty array. The excludePlatforms array must be empty if includePlatforms contains values. You can retrieve the platform name strings with the CompilationPipeline.GetAssemblyDefinitionPlatforms function (support for a platform must be installed for the current Editor when calling this function.) See Platforms.
"includePlatforms": [],
"excludePlatforms": [
"iOS",
"macOSStandalone",
"tvOS"
]
Optional. The platform name strings to include or an empty array. The includePlatforms array must be empty if excludePlatforms contains values. You can retrieve the platform name strings with the CompilationPipeline.GetAssemblyDefinitionPlatforms function (support for a platform must be installed for the current Editor when calling this function.) See Platforms.
"includePlatforms": [
"Android",
"LinuxStandalone64",
"WebGL"
],
"excludePlatforms": []
Required. Any legal assembly name.
"name" : "MyAssemblyName"
Optional. Defaults to false. See No Engine References.
"noEngineReferences": false
Optional. In earlier versions of Unity, this field serialized the Unity References : Test Assemblies option used to designate the assembly as a test assembly. As of Unity 2019.3, the option is no longer displayed. The field is still supported, but if the asset is reserialized in a newer version of the Unity Editor, the field is replaced by the equivalent assembly references.
See Creating a test assembly for more information about test assemblies.
"optionalUnityReferences": [
"TestAssemblies"
]
Optional. Set to true if precompiledReferences contains values. Defaults to false.
See [Override References].
"overrideReferences": true
Optional. The file names of referenced DLL libraries including extension, but without other path elements. Can be empty. This array is ignored unless you set overrideReferences to true.
See Assembly References.
"overrideReferences": true,
"precompiledReferences": [
"Newtonsoft.Json.dll",
"nunit.framework.dll"
]
Optional. References to other assemblies created with Assembly Definition assets. You can use either the GUID of the Assembly Definition asset file or the name of the assembly (as defined by the name field of the Assembly Definition). You must use the same form for all references in the list. Can be empty.
You can use the AssetDatabase.AssetPathToGUID function to retrieve the GUID of an asset. (The GUID is also part of the metadata associated with every asset.)
Note that the Editor displays a Use GUIDs option in the Assembly Definition Inspector. This option is not serialized in the associated JSON file. Instead, the choice is inferred from the form of reference found in the file.
See Referencing another assembly.
Using GUIDs:
"references": [
"GUID:17b36165d09634a48bf5a0e4bb27f4bd",
"GUID:b470eee7144904e59a1064b70fa1b086",
"GUID:2bafac87e7f4b9b418d9448d219b01ab",
"GUID:27619889b8ba8c24980f49ee34dbb44a",
"GUID:0acc523941302664db1f4e527237feb3"
]
Using assembly names:
"references": [
"Unity.CollabProxy.Editor",
"AssemblyB",
"UnityEngine.UI",
"UnityEngine.TestRunner",
"UnityEditor.TestRunner"
]
Optional. Contains an object for each version define. This object has three fields:
See Version Defines.
"versionDefines": [
{
"name": "com.unity.ide.vscode",
"expression": "[1.7,2.4.1]",
"define": "MY_SYMBOL"
},
{
"name": "com.unity.test-framework",
"expression": "[2.7.2-preview.8]",
"define": "TESTS"
}
]
Using assembly names for references to other Assembly Definitions and includePlatforms:
{
"name": "BeeAssembly",
"references": [
"Unity.CollabProxy.Editor",
"AssemblyB",
"UnityEngine.UI",
"UnityEngine.TestRunner",
"UnityEditor.TestRunner"
],
"includePlatforms": [
"Android",
"LinuxStandalone64",
"WebGL"
],
"excludePlatforms": [],
"overrideReferences": true,
"precompiledReferences": [
"Newtonsoft.Json.dll",
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_2019",
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [
{
"name": "com.unity.ide.vscode",
"expression": "[1.7,2.4.1]",
"define": "MY_SYMBOL"
},
{
"name": "com.unity.test-framework",
"expression": "[2.7.2-preview.8]",
"define": "TESTS"
}
],
"noEngineReferences": false
}
Using GUIDS for references to other Assembly Definitions and excludePlatforms:
{
"name": "BeeAssembly",
"references": [
"GUID:17b36165d09634a48bf5a0e4bb27f4bd",
"GUID:b470eee7144904e59a1064b70fa1b086",
"GUID:2bafac87e7f4b9b418d9448d219b01ab",
"GUID:27619889b8ba8c24980f49ee34dbb44a",
"GUID:0acc523941302664db1f4e527237feb3"
],
"includePlatforms": [],
"excludePlatforms": [
"iOS",
"macOSStandalone",
"tvOS"
],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"Newtonsoft.Json.dll",
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_2019",
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [
{
"name": "com.unity.ide.vscode",
"expression": "[1.7,2.4.1]",
"define": "MY_SYMBOL"
},
{
"name": "com.unity.test-framework",
"expression": "[2.7.2-preview.8]",
"define": "TESTS"
}
],
"noEngineReferences": false
}
An Assembly Definition Reference is a JSON object with the following field:
Required. The assembly definition to reference. See Assembly Definition References.
You can reference an Assembly Definition asset using either the name of the assembly or the GUID of the asset.You can use the AssetDatabase.AssetPathToGUID function to retrieve the GUID of an asset. (The GUID is also part of the metadata associated with every asset.)
Using assembly name:
{
"reference": "AssemblyA"
}
Using Assembly Definition asset GUID
{
"reference": "GUID:f4de40948f4904ecb94b59dd38aab8a1"
}