{"id":45,"date":"2021-10-24T07:17:23","date_gmt":"2021-10-24T07:17:23","guid":{"rendered":"https:\/\/docs.sisus.co\/inity\/?p=45"},"modified":"2025-07-14T19:39:00","modified_gmt":"2025-07-14T19:39:00","slug":"assembly-definitions","status":"publish","type":"post","link":"https:\/\/docs.sisus.co\/init-args\/installation\/assembly-definitions\/","title":{"rendered":"2. Referencing Init(args) Assemblies"},"content":{"rendered":"<p>To reference code in Init(args) from your own code you need to create <a href=\"https:\/\/docs.unity3d.com\/Manual\/ScriptCompilationAssemblyDefinitionFiles.html\">assembly definition assets<\/a> in the roots of your script folders and add references to the assemblies containing the scripts you want to use.<\/p>\n<p>Init(args) contains three assemblies:<\/p>\n<ol>\n<li><b>InitArgs<\/b> \u2013 The main assembly that contains most classes including <a href=\"https:\/\/docs.sisus.co\/init-args\/features\/monobehaviour-t\/\">MonoBehaviour&lt;T&#8230;&gt;<\/a>.<\/li>\n<li><b>InitArgs.Services<\/b> \u2013 This contains only a handful of classes related to service registeration: <a href=\"https:\/\/docs.sisus.co\/init-args-reference\/class_sisus_1_1_init_1_1_service_attribute.html\">ServiceAttribute<\/a>, <a href=\"https:\/\/docs.sisus.co\/init-args-reference\/class_sisus_1_1_init_1_1_editor_service_attribute.html\">EditorServiceAttribute<\/a> and ServiceInitializer&lt;T&#8230;&gt;.<\/li>\n<li><b>InitArgs.Editor<\/b> \u2013 Editor-only assembly containing classes related to unit testing as well as custom editors and property drawers for the Inspector.<\/li>\n<\/ol>\n<h2>Assembly Setup<\/h2>\n<p>Most of your client components will only need to reference types found in the <i>InitArgs<\/i> assembly, so add a reference to that in your assembly definition assets as needed.<\/p>\n<p>Additionally, any classes that you want to use global services, need to reference the <em>InitArgs.Services<\/em> assembly so that they can use the <a href=\"https:\/\/docs.sisus.co\/init-args-reference\/class_sisus_1_1_init_1_1_service_attribute.html\">ServiceAttribute<\/a>.<\/p>\n<p>The <em>InitArgs.Editor<\/em> assembly you should only reference from your own editor-only assemblies. This might be useful when writing edit mode unit tests, if you want to make use of the Testable class to invoke non-public Unity event functions or the EditorCoroutine class to run coroutines.<\/p>\n<h2><span style=\"font-family: Liberation Sans, sans-serif;\"><span style=\"font-size: x-large;\">Sisus.Init Namespace<\/span><\/span><\/h2>\n<p>To reference code in Init(args) you also need to add the following using directive to your classes:<\/p>\n<pre class=\"western\"><span style=\"color: #000000;\"><span style=\"color: #800000;\"><b>using<\/b><\/span> Sisus<span style=\"color: #808030;\"><span style=\"font-size: small;\"><i>.<\/i><\/span><\/span>Init<span style=\"color: #800080;\">;<\/span><\/span><\/pre>\n<h2>Null Extensions<\/h2>\n<p>In all MonoBehaviour&lt;T&#8230;&gt; derived class you can have access to the <a href=\"https:\/\/docs.sisus.co\/init-args\/features\/null-nullorinactive\/\">Null<\/a> property, which can be used for convenient null-checking of interface type variables, with support for identifying destroyed Objects as well:<\/p>\n<pre class=\"western\"><span style=\"color: #000000;\"><span style=\"color: #800000;\"><b>if<span style=\"color: #800080;\"><span style=\"color: #808030;\"><span style=\"font-size: small;\">(<\/span><\/span><\/span><\/b><\/span>interfaceVariable <strong><span style=\"color: #808030;\"><span style=\"font-size: small;\">!= <\/span><\/span><\/strong>Null<strong><span style=\"color: #800080;\"><span style=\"color: #808030;\"><span style=\"font-size: small;\">)<\/span><\/span><\/span><\/strong><\/span><\/pre>\n<p>If you want to be able to do the same thing in other types of classes, you can also import the Null property from the NullExtensions class:<\/p>\n<pre class=\"western\"><span style=\"color: #000000;\"><span style=\"color: #800000;\"><b>using static<\/b><\/span> Sisus<span style=\"color: #808030;\"><span style=\"font-size: small;\"><i>.<\/i><\/span><\/span>NullExtensions<span style=\"color: #800080;\">;<\/span><\/span><\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To reference code in Init(args) from your own code you need to create assembly definition assets in the roots of your script folders and add references to the assemblies containing the scripts you want to use. Init(args) contains three assemblies: InitArgs \u2013 The main assembly that contains most classes including MonoBehaviour&lt;T&#8230;&gt;. InitArgs.Services \u2013 This contains ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/docs.sisus.co\/init-args\/installation\/assembly-definitions\/\" title=\"read more\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"https:\/\/docs.sisus.co\/init-args\/wp-json\/wp\/v2\/posts\/45"}],"collection":[{"href":"https:\/\/docs.sisus.co\/init-args\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.sisus.co\/init-args\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.sisus.co\/init-args\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.sisus.co\/init-args\/wp-json\/wp\/v2\/comments?post=45"}],"version-history":[{"count":12,"href":"https:\/\/docs.sisus.co\/init-args\/wp-json\/wp\/v2\/posts\/45\/revisions"}],"predecessor-version":[{"id":621,"href":"https:\/\/docs.sisus.co\/init-args\/wp-json\/wp\/v2\/posts\/45\/revisions\/621"}],"wp:attachment":[{"href":"https:\/\/docs.sisus.co\/init-args\/wp-json\/wp\/v2\/media?parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.sisus.co\/init-args\/wp-json\/wp\/v2\/categories?post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.sisus.co\/init-args\/wp-json\/wp\/v2\/tags?post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}