Hum …no thanks ! – Lordinaire

Tag: unity (Page 1 of 6)

Build and deploy your Unity game with Visual Studio Online and App Center – Part 1

When you develop a game with Unity3D and you want to take advantage of the Microsoft ecosystem like Visual Studio Online, it can be hard to configure your CI/CD environment. This blog post will explain how to set up that from pushing code to deploy the game on device automatically.

  • Part 1 : Build with Unity CLI
  • Part 2 : Continuous Integration with Visual Studio Online
  • Part 3 : Continuous Delivery with Visual Studio Online
  • Part 4 : Deploy with App Center

I can’t cover all platforms so I will only focus on Android. It’s pretty much the same stuff  for other platforms. The name of the game will be : “Adam Must Live” (yes, it’s an in progress game ;))

Unity CLI

So, you have a game that you want to build for the Android platform. Great! What’s next ? Command line arguments.

The first thing to do is to create a script that can be used to build the game without any user interaction and the Unity CLI is the perfect target for doing that. Create a folder named Editor in your Assets folder and add a new script named MyEditorScript.cs :

using System.IO;
using System.Linq;
using UnityEditor;

public class MyEditorScript
    public static void PerformBuild()
        // Get all actives scenes
        var scenes = EditorBuildSettings.scenes.Where(s => s.enabled).Select(s => s.path).ToArray();

        var outputFile = "./Builds/Android/AdamMustLive.apk";
        if (File.Exists(outputFile))

        var buildPlayerOptions =
            new BuildPlayerOptions
                scenes = scenes,
                locationPathName = outputFile,
                target = BuildTarget.Android,
                options = BuildOptions.None

This static method can now be called be the CLI to build the game and generate the .apk file. We just need to run the command :

C:\Program Files\Unity\Hub\Editor\2018.1.1f1\Editor\Unity.exe -quit -batchmode -projectPath UNITY_PROJECT_PATH -executeMethod MyEditorScript.PerformBuild

We use the -batchmode to run Unity editor in a non-interactive mode (no user interaction will be required). The -quit option forces Unity to close himself when the task ends.

If you planned to install Unity on a machine hat don’t have a graphic card, you may need to add the parameter -nographics but some restrictions will be applied.

In the next post, we will see how to create a build definition with Visual Studio Online.


[Unity] Visual Studio Tools for Unity 2.0

The Microsoft team in charge of the tooling for Unity has just released version 2.0 of Visual Studio Tools for Unity. For those who do not use Visual Studio as IDE (guys … really ?!), take a few minutes to try this awesome product!

Here is an overview of what you can achieve with this tool:

  • Debug your game on VS (breakpoints, exceptions, …)
  • Create scripts (MonoBehavior …)
  • Errors on the Unity editor are linked to the VS error window
  • Code Coloration for Unity’s shaders (VS 2015 only)
  • Resharper :)

For more information, see the official post :

Have fun!

Page 1 of 6

Powered by WordPress & Theme by Anders Norén

%d bloggers like this: