Create a Build in Unity

In order to create replays in Luna Playground, you will need to first create and upload a standalone Linux build.

To do this, you can create a build manually, or use the Luna build feature which will create the Linux build with the correct settings.

Preparing the build

Using Luna Replay (recommended)

  1. In Unity, select Tools > Luna Replay > Building for Playground > Build Linux in the menu bar.
images

Manually

  1. Open the project in Unity and install the Luna Replay plugin.
  2. Ensure you have configured your game variables and enabled capture mode.
  3. Open File > Build Settings.
  4. If required, switch your target platform to PC, MAC and Linux Standalone and select Linux in the Target Platform dropdown menu.
Please ensure you select the x86_64 architecture.
  • Select your scene
  • Make sure Development Build is not selected
  • Make sure Server Build is not selected
images-small
  1. Build the project.

Saving the Linux build

Whether you build automatically through Luna Replay, or manually through the Unity build settings, you will need to name and save the Linux build output.

  1. When the output dialogue opens, we suggest that you create a new folder called "LinuxBuild".
  2. When the build completes, you will have three files in the LinuxBuild folder.

Depending on your version of Unity, the output from a Linux build can cary, as show below.

images-small
images-small
  1. Create an archive (.zip) from all of the files created by the Linux build.

That's it - you're now ready to move on and upload the build!


Fixing build errors

When you build your project for Linux, you may find that the build fails. This is fairly common, but simple to fix.

By using the console, identify where the build is failing - typically this will be on a method which isn't supported by Linux, for example, Handheld.Vibrate, which is used on mobile devices but not available for Linux.

To work around APIs not available on Linux platform, developers can use a conditional #if operator with UNITY_STANDALONE_LINUX symbol, just like UNITY_EDITOR is used for similar workarounds.

Linux Standalone target is in fact very similar to Unity Editor target - an implicit target developers use to run the project from within the Unity Editor itself. Given the game compiles and runs in the editor, it is often trivial to make it run on Standalone target as well.

Example

void OnVibrate() {
// If not a Linux build
#if !UNITY_STANDALONE_LINUX
Handheld.Vibrate();
#endif
}

Handling unexpected behaviour

You may find that the output of your Linux build is unexpected.

This occurs when your input system in Unity is disabled for standalone builds. In order to fix this, you simply need to include the UNITY_STANDALONE_LINUX defines, typically where you have already used the UNITY_EDITOR defines.

Input

Sometimes, specific input methods may be wrapped in defines symbols, meaning that input does not work in a Linux build. Simply include the UNITY_STANDALONE_LINUX defines in the same place as these to ensure input works accordingly.