# Real Virtual Unity integration

> Introduction and Setup to the RealVirtual and Nova interface inside Unity.

# Simulate using RealVirtual.io

Wandelbots NOVA allows you to connect your Unity Editor with your Wandelbots NOVA instance via the realvirtual.io assets.

> **Info:** In order to use Unity integration with NOVA you are going to need an additional license from
> [realvirtual.io.](https://realvirtual.io/)

## Prerequisites

Make sure you have downloaded
[Unity](https://unity.com)
and
[realvirtual.io.](https://realvirtual.io/en/buy/)

## Video tutorial

The following video shows all the steps that you need to perform to get Unity running with realvirtual.io and the Wandelbots NOVA interface.

Video: [/video/unity/Unityrvnova-onboarding.webm](/video/unity/Unityrvnova-onboarding.webm)

Before following the steps below, please make sure you have downloaded
[Unity](https://unity.com)
and
[realvirtual.io.](https://realvirtual.io/en/buy/)

### Step 1: Create a new project

1. Open the Unity hub.
2. Create a new project by clicking on `Create project` and then selecting `Universal 3D core` as the project template.
3. Name your project and click on `Create`.\
   → The Unity editor opens with the default template.

![create project in unity hub; node](/assets/nova/unity/create_project.webp)

### Step 2: Open RV assets

1. Once the Unity editor is open, click on `Assets` → `Import Package` → `Custom Package`.
2. Select the realvirtual.io package you have downloaded.\
   If possible, always use the latest version.
3. To proceed with the integration, you have to agree to the realvirtual.io Terms and Conditions when prompted.\
   → The RV assets are loaded.

![create project in unity hub; node](/assets/nova/unity/import_custom_package.webp)

### Step 3: Open Wandelbots NOVA interface

Once the realvirtual.io assets are loaded, you should be able to see a demo scene on the scene window.

1. To open the NOVA interface, you need to follow this specific hierarchy in the project folder structure (lower-left window block).
2. Go to `Assets` → `RealVirtual` → `Interfaces` → `WandelbotsNOVA`.\
   → The demo scene folder `DemowandelbotsNova` is displayed.

![create project in unity hub; node](/assets/nova/unity/nova_interface_hierarchy.webp)

3. Drag and drop the demo scene inside the hierarchy to load it.
4. If displayed: Click on `Import TMP essentials`.
5. Remove the `demo realvirtual cell` to make sure the cells are not overlapping each other.

### Step 4: Download package `newtonsoft-json`

Wandelbots NOVA requires the package `newtonsoft-json`.

1. Click on `Windows` → `Package manager` to download it.
2. Click `+↓` and select `Install package by name`.
3. Enter `com.unity.nuget.newtonsoft-json` as the desired package name.+
4. Click on `Install`.\
   → The package manager displays the required `newtonsoft-json` package.

![create project in unity hub; node](/assets/nova/unity/newton_soft.webp)

Next, add this package to our player settings. Click on the search bar on the top-right and type “player settings”. In the search results, select “player project - player”.
Scroll down to the script compilation section and then click on “+”.
Add the following under “scripting define symbols” and click on apply:

```python
REALVIRTUAL_JSON
```

### Step 5: Add `newtonsoft-json` to player settings

1. Use the search bar and search `Player settings`.\
   → The search results display `Player project - player`.
2. Select `Player project - player`.
3. Scroll down to the script compilation section and click on `+`.
4. In `Scripting define symbols`, add `REALVIRTUAL_JSON` and click on apply.\
   → The newtonsoft-json is added to the player settings.

Wandelbots NOVA is prepared to connect to realvirtual.

### Step 6: Connect Realvirtual to Wandelbots NOVA

1. Using Wandelbots NOVA, add a **virtual** robot to the cell using the Setup app: select FANUC as the robot manufacturer and `fanuc-crx10ial` as model.\
   See the [Wandelbots NOVA Quickstart](/nova/latest/quickstart) for more information.
2. Open Robot Pad.

![create project in unity hub; node](/assets/nova/unity/create_robot.webp)

Now that the Wandelbots NOVA instance features a Unity editor, you can connect it to Reealvirtual. A successful connection is established via the instance URL and access token of a cloud instance or the instance URL for IPCs.

3. In the Unity editor, go to `wandelbotsNovaInterface` in the folder hierarchy and enter the instance URL and the access token in their respective fields.

> **Info:** Depending on your instance type, you need to preface the instance URLs.
>
> **Local instance**: preface the URL with `http://`.
> **Cloud instance**: preface the URL with `https://`.

4. Scroll down on the inspector page for `wandelbotsNovaInterface` and click on `save 0 pos` to save the robot's default position.\
   This helps debugging during path planning in Teach mode.
5. Start the demo scene by clicking on the Play button.\
   → The FANUC in Wandelbots NOVA Robot Pad as well as the FANUC in the Unity Editor execute the same movements.

![create project in unity hub; node](/assets/nova/unity/add_creds.webp)

### Step 7: Teach mode

To jog and save target positions, teach mode needs to be enabled.

1. Go to the inspector page of `wandelbotsNovaInterface`.
2. Click on `Teach mode ON`.\
   → Jogging controls will be displayed.

Saved positions will only be saved in Unity.

![create project in unity hub; node](/assets/nova/unity/teach_mode.webp)

Congrats, your demo cell is ready to explore 🚀.
Find more information on [realvirtual.io](https://doc.realvirtual.io/).

Some of your questions have been left unanswered? Try out the search function or [visit the FAQ page](/nova/latest/faq).
