Click or drag to resize

Build Server Integration

In this guide, we give an overview of how to handle source control and how to automate the import process, e.g. for a build server.

Source Control

Everything below the folder Assets\ArticyImporter\Content\Generated can be regenerated from the plugin with an import.
Therefore, this folder does not need to be in the repository. There are some exceptions you can learn more about in the limitations and special cases sections.

Starting an import

Inside Unity: via editor script

You can start an import by calling ImportArticyExport(Boolean).
Don’t forget that the script calling this method must be placed inside a folder called Editor, because it is calling an editor-only method.

Outside Unity: command line argument

  • -articyImport
    Performs a full import right after the editor launched.
  • -articyQuit
    Similar to Unity's -quit command line argument.
    Quits Unity after the import finished and the optional post-import method has been executed.
    Return code 0 – import successful
    Return code 201 – import failed
  • -articyPostImportMethod <method>
    Similar to Unity's -executeMethod command line argument.
    Method gets executed after the import has finished. The method must be static and provided in the format Class.Method or Namespace.Class.Method.
    Quits Unity on errors.
    Return code 201 – import failed
    Return code 202 – execute method failed
  • -articyHideProgressBars
    Hides all progress bars.
    This command line switch is usually not necessary. It is only required when not using -batchmode in environments where the Unity editor loses focus when a progress bar pops up. On a focus lost our plugin cannot finish the import, because Unity does not (re)compile the C# code our plugin generates during an import.
Note Note

•When using -batchmode it is required to use -ignoreCompilerErrors.
•The articy command line arguments do not work combined with the -quit command line argument.

See limitations for more information.

Example 1: Jenkins
jenkins example 1
Example 2: Jenkins with Jenkins Unity plugin
jenkins example 2
Get informed about the import progress

Inside Unity: via editor script

You can use the delegate importStateChanged to get informed of the current state of the import.

C#
using UnityEditor;
using Articy.Unity.Editor.Utils;

[InitializeOnLoad]
static class MyEditorScript
{
    static MyEditorScript()
    {
        ArticyEditorUtility.importStateChanged += ArticyImportStateChanged;
    }

    static void ArticyImportStateChanged(ArticyImportState aState)
    {
        if (aState == ArticyImportState.Started)
        {
            // import has just been started.
        }
        else if (aState == ArticyImportState.Succeeded)
        {
            // import finished successfully.
        }
        else if (aState == ArticyImportState.Failed)
        {
            // import failed.
        }
    }
}

Outside Unity: lock files

Two different files appear inside the root of your Unity project, which can be used to check the current state of the import.

  • ArticyImportRunning: Indicates that the import is currently running.
  • ArticyImportFailed: Indicates that the last import failed.
Limitations

It is not possible to perform a full import of all articy:draft data when Unity got started in batch mode without the -ignoreCompilerErrors command line argument. Furthermore using the -articyQuit command line argument must be used instead of -quit.

This has two reasons:
When the C# files that the plugin generates are missing, it leads to compilation errors in most cases. Unity quits itself due to the compilation errors before the plugin generates the missing C# files.
If you open your project in a state without compilation errors, then it still won’t work, because during a full import of the articy:draft data the plugin needs to wait for two recompiles. Unity will quit itself after the first recompile.

Special Cases

Unity Cloud Build

For Unity Cloud Build it is required to commit all generated files and to call PrepareForCloudBuild on the build server in or as the pre-export method.

See Also