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)
- In Unity, select
Tools > Luna Replay > Building for Playground > Build Linuxin the menu bar.
- Open the project in Unity and install the Luna Replay plugin.
- Ensure you have configured your game variables and enabled capture mode.
File > Build Settings.
- If required, switch your target platform to PC, MAC and Linux Standalone and select Linux in the Target Platform dropdown menu.
- Select your scene
- Make sure Development Build is not selected
- Make sure Server Build is not selected
- 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.
- When the output dialogue opens, we suggest that you create a new folder called "LinuxBuild".
- 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.
- 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.
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
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.