Main Content

Exporting to Unity

Unity Overview

RoadRunner can export scenes to Unity® format. The Unity export option exports a Filmbox (.fbx) file containing the 3D objects in a scene along with an additional XML file to hold extra data for materials and traffic signals in the scene.

On the Unity side, a set of scripts are included in the RoadRunnerUnityTool asset package to help import the FBX® file using the information stored in the XML file. The script handles the following details:

  • Setting up materials

    • Material data is read in from the XML file and mapped into the included custom shaders.

  • Adding colliders to roads and terrain

    • Colliders are added to all imported meshes.

  • Setting up the components of traffic signals

    • Signal data is read in from the XML file to create a new game object in the prefab, with the light bulb references to game objects set up during import.

    • The traffic signals will cycle through their phases during play mode.

    • The UUIDs prefixed in the game object for prop instances are needed only at import time to set up references to game objects in the traffic signal script so that they can be renamed freely.

  • Unity software requirements: Unity Version 2017.3+

Installing the Import Tool

Follow the instructions in this section to install the Import Tool into your Unity project.

  1. See the page Downloading Plugins for instructions for downloading the latest version of the plugin.

  2. Extract the RoadRunner Plugins zip file and locate the "RoadRunnerUnityTool.unitypackage" file in the "Unity" folder.

  3. Open your project in Unity.

  4. Open the RoadRunnerUnityTool asset package file to import it. Alternatively, drag the package file into the Unity Project window, or select

    Assets > Import Package > Custom Package and then select the package file.

  5. Click Import in the Import Unity Package dialog box.

Selecting Package Files to Import

The package includes some extra files to add a drivable vehicle to your scene. If you do not need these extra files, then you can deselect them when you import the package.

The essential scripts inside the "RoadRunner" folder are needed to set up the materials and traffic signals in the scene.

Package Contents

  • Models: Mesh, materials, and textures for the drivable car prefab.

  • Prefabs: The prefab for the car with scripts set up.

  • RoadRunner:

    • ImportWindow.cs: Editor window to display messages for the RoadRunner importer.

    • RoadRunnerImporter.cs: Editor script for importing the FBX file with the data from the XML file.

    • Metadata.cs: Contains classes to hold the imported metadata XML file.

    • TrafficJunction.cs: Component for controlling signals from data in the XML file at import time.

    • Various shaders to match RoadRunner material settings.

  • Scripts: For the Sedan prefab.

  • Standard Assets: For the Sedan prefab.

Exporting from RoadRunner to Unity

Follow these steps to export a scene from RoadRunner to Unity:

  1. Open your scene in RoadRunner.

  2. Export the scene to Unity format using File > Export > Unity (.fbx + .xml) from the Main Menu.

  3. In the Export Unity dialog box, set your desired options, and then click Export.

  4. Browse to open the file dialog box to set the exported file's name and path. The textures and the XML file are exported to the same folder. (Tip: Create a new folder when choosing a file location, so you can import the entire folder into Unity.)

  • The mesh can be split by segmentation type. Meshes have "<segmentation type>Node" appended to their names.

  • If the Export To Tiles option is selected, meshes are split per tile. Props are grouped by the tile they are in.

    • By default, only one file is exported. Tiles are stored in separate nodes.

    • If Export Individual Tiles is enabled, each tile will be stored in its own FBX file.

  • When exporting with Embed Textures selected, you need to manually extract the textures inside Unity.

Importing into Unity

To import a scene into Unity that you previously exported from RoadRunner, drag all the exported files (or the entire folder) into the Unity project window. Alternatively, use Assets > Import New Asset in Unity and select all the exported files.

The output window that opens contains log messages from the import plugin.

(Optional) Test Drive in Unity

You can place and drive a car model around an imported scene by following these steps:

  1. Drag the Sedan prefab from the Prefabs folder into the scene. (Note: In some versions of Unity, you might need to manually tag the Main Camera as "MainCamera" for some scripts to work.)

  2. Click Run.

About Importing Traffic Signals into Unity

If traffic signals were set up in RoadRunner, then they are imported into Unity as junction controllers. These controllers are automatically created during import and attached to the prefab.

Prop instances for traffic signals are prefixed by their UUID so that the traffic signal controller has a way to identify which signals it controls. The TrafficJunction script handles the logic for switching between signal states.

FBX details

The FBX file is identical to the one exported from the Filmbox export option. The only difference is the extra rrdata.xml metadata file.

Setting Up the Sample Vehicle

The RoadRunnerUnityTool unitypackage also includes the RoadRunner Sedan 3D model. This section covers how to set it up with Unity Standard Assets.


The following section was tested on Unity 2019.1. Older versions might require different steps to modify prefabs.

Adding the Standard Assets

  1. Download the "Standard Assets (for Unity 2017.3)" package from the Unity Asset Store.

  2. Select the following folders to import:

    • "Standard Assets/Cameras"

    • "Standard Assets/CrossPlatformInput/Scripts"

    • "Standard Assets/Editor/CrossPlatformInput"

    • "Standard Assets/Vehicles/Car"

  3. Import the package by clicking Import.

Setting Up the Sedan Prefab

  1. Select the Sedan prefab (located in "Assets/Prefabs") and click Open Prefab in the Inspector window.

  2. For each Wheel Hub Game Object under "Sedan/WheelsHubs" (for example, "WheelHubFrontRight"), complete these steps:

    1. Add the "Wheel Effects" component.

      • Set the "Skid Trail Prefab" to the "SkidTrail" Prefab (located in "Assets/Standard Assets/Vehicles/Car/Prefabs").

    2. Set the Audio Source's "AudioClip" to the "Skid" sound effect if it is missing.

  3. Select the top level "Sedan" game object in the hierarchy window.

    1. Add the "Car Controller" component with the following settings.

      To avoid errors, verify that the order of the wheels is correct.

    2. Add the "Car Audio" component with the following settings.

    3. Add the "Car User Control" component.

  4. Select the "light_brakes" game object.

    1. Add the "Brake Light" component and set the "Car" property to the top level "Sedan" game object.

  5. Select the "ParticleBurnoutSmoke" game object.

    1. Enable the game object.

    2. Set the Particle System component's Renderer Material property to "ParticleSmokeWhite".

  6. Exit Prefab edit mode.

Setting Up the Camera

  1. Delete any existing cameras in the scene.

  2. Add the Sedan prefab to the scene.

  3. Add the "MultipurposeCameraRig" prefab (located in "Standard Assets/Cameras/Prefabs") to the scene with the following settings.

Running the Scene

Add in an imported RoadRunner scene and click play to drive around in it.