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"
}
See Creating an Assembly Definition Reference asset.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.
When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
More information
These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising. Some 3rd party video providers do not allow video views without targeting cookies. If you are experiencing difficulty viewing a video, you will need to set your cookie preferences for targeting to yes if you wish to view videos from these providers. Unity does not control this.
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.