How to Unpack the Source Code

As a convenience, the Dialogue System comes with precompiled DLLs that will significantly shorten your compile times.


Recommendation: Use Subclasses, Messages, and Delegates When Possible

When implementing additional functionality, it's strongly recommended to create subclasses rather than unpacking and directly modifying the source code. First, you won't have to fix up prefab references, since the prefabs reference the classes in the DLLs. Second, if you directly modify the source code, you'll overwrite your customizations whenever you import an updated version of the Dialogue System.

The Dialogue System has been designed to make it easy to create subclasses for customization. It also includes several Templates to get you started.

It also sends several Script Messages that your own scripts can listen for instead of directly modifying the source code.


Unpacking the Source Code

Complete source code is provided, however. To unpack it, import the package Assets/Dialogue System/Scripts/Source Code.unitypackage.

If you only want to unpack the editor source code, see Unpacking the Editor Source Code Only.

The included prefabs, such as pre-built UIs, reference the DLLs. If you replace the DLLs with the source scripts, you'll have to reassign the prefabs' script references to point to the source scripts. The easiest way to do this is to open two projects: one with the DLLS and one with the source code. In the DLL project, select each prefab and/or scene object that your project uses. In the source code project, select the same prefab/object and assign the corresponding script to each missing reference.

Scriptable objects such as dialogue databases need to be handled differently. In the DLL project, open the dialogue database in the Dialogue Editor and, on the Database tab, export it as Chat Mapper XML. In the source project, assign the DialogueDatabase.cs script to the dialogue database asset. If the database appears empty, import it from the XML using the Chat Mapper Converter.

Unpacking the Editor Source Code Only

Since the editor scripts use no references on prefabs or GameObjects, it's much easier to unpack them. Here are the steps:

  1. Delete the folder Dialogue System/DLLs/Editor.
  2. Import SourceCode.unitypackage. Only import these 2 folders:
    • Scripts/Core/Editor
    • Scripts/Supplemental/Editor

Link.xml and Stripping

When building for mobile platforms such as iOS, Unity can strip unused code to reduce build size. The Dialogue System's sequencer relies on reflection. Unity's stripping doesn't recognize code that is referenced through reflection, so without an extra step it will remove the Dialogue System from your build. The file Prefabs/iOS/link.xml tells Unity to keep the Dialogue System DLLs (assemblies) in the build. You must move this file into the root Assets folder for Unity to recognize it.

If you remove the DLLs and build from source code instead, the Dialogue System's code will be moved to the default "Assembly-CSharp" assembly. In this case, change the assembly name in link.xml to "Assembly-CSharp".


Link.xml and Stripping

When building for mobile platforms such as iOS and Android, Unity can strip unused code to reduce build size. The Dialogue System's sequencer relies on reflection. Unity's stripping doesn't recognize code that is referenced through reflection, so without an extra step it will remove the Dialogue System from your build. The file Prefabs/Mobile/link.xml tells Unity to keep the Dialogue System DLLs (assemblies) in the build. You must move this file into the root Assets folder for Unity to recognize it. (The Mobile folder was formerly named iOS.)

If you remove the DLLs and build from source code instead, the Dialogue System's code will be moved to the default "Assembly-CSharp" assembly. In this case, change the assembly name in link.xml to "Assembly-CSharp".

See also: My mobile game doesn't use networking. Why does my build ask for networking permissions?


<< Scripting | Source Code Structure >>