Skip to content

Getting Started

Emanuele Manzione edited this page Mar 10, 2022 · 13 revisions

Forewords

The whole documentation assumes you are working on Windows, so commands and everything else refer to its environment. If you work on a different OS, don't worry: the process is the same, very minor changes in commandline commands are needed.

Also, it assumes you own the PATCH - Updating System package from Unity's Asset Store.

Installation

Unity

Just import the package in your project into Unity Editor. After importing, your project should contain atleast these folders:

After import

To check if it is correctly installed, go on Window menu and make sure you can find the PATCH menu item.

Window

Click on Admin Tool to start an in-editor tutorial! Follow it together with this Wiki!

How does this updater work?

Before we dive into the software itself, a little bit of theory. I know, I know: it is boring. But it is needed. In this way you completely understand what we are going to do here.

When you develop a game or an application, you also want the ability to deploy updates and fixes for it. There are multiple ways you can deliver updates for your software, but the most intuitive one in my opinion is the classic Launcher. The Launcher is a software that is not embedded into your own application/game: it is standalone and it is started before your game. It repairs corrupted/damaged files, it checks for updates, it applies updates, then it starts your game if everything is ready.

You may also need to deploy updates for the Launcher itself: so it also needs to self-update. In this package I propose two ways of self-updating: one for Unity and one for WPF.

Scenes

The package comes with an example of a classic updating architecture. You can find sample scenes in MHLab/Patch/Launcher/Scenes:

  • Launcher. It is the scene that contains your Launcher logic and UI. It updates your game. In the hierarchy find a LauncherData game object: it contains settings for your Launcher script.
  • PreGame. It is the scene that contains your Launcher self-updating logic and UI. It updates your Launcher. You need to set it as first scene in your game. In the hierarchy find a LauncherData game object: it contains settings for your LauncherUpdater script.
  • SampleGame. It represents your game, it is just a placeholder.

Setting up

To distribute updates you will need a web server or any other service that can serve files over HTTP. The Launcher's downloader can access files through direct URLs, like: http://yourIP/yourFolder/yourFile.exe, so make sure that your files host serves them correctly! For testing purposes you can also use a local web server like WAMP.

Decide what will be your remote workspace on your web server: I'll pick http://localhost/patch/ folder. So fill LauncherData component with your settings in both Launcher and PreGame scenes.

Launcher Data

In PreGame scene you will also find the LauncherUpdater game object: set the Scene To Load property inside its LauncherUpdater component. It is the index of your game scene in your build settings.

Build settings

When you build your Launcher, you have to include atleast the Launcher scene at index 0.

Launcher build settings

When you build your Game, you have to include the PreGame scene at index 0. SampleGame represents your main game scene.

Game build settings