02. Referencing Init(args) Assemblies

  02. Installation No Comments

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:

  1. InitArgs – The main assembly that contains most classes including MonoBehaviour<T…>.
  2. InitArgs.Services – This contains only a handful of classes related to service registeration: ServiceAttribute, EditorServiceAttribute and ServiceInitializer<T…>.
  3. InitArgs.Editor – Editor-only assembly containing classes related to unit testing as well as custom editors and property drawers for the Inspector.

Assembly Setup

Most of your client components will only need to reference types found in the InitArgs assembly, so add a reference to that in your assembly definition assets as needed.

Additionally, any classes that you want to use global services, need to reference the InitArgs.Services assembly so that they can use the ServiceAttribute.

The InitArgs.Editor 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.

Sisus.Init Namespace

To reference code in Init(args) you also need to add the following using directive to your classes:

using Sisus.Init;

Null Extensions

In all MonoBehaviour<T…> derived class you can have access to the Null property, which can be used for convenient null-checking of interface type variables, with support for identifying destroyed Objects as well:

if(interfaceVariable != Null)

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:

using static Sisus.NullExtensions;


Leave a Reply

Your email address will not be published. Required fields are marked *