# Building for VR

## VR Installation

If you want to make your Convai Plugin compatible with VR, you can do so using the automatic or manual process. Please see the instructions below or check out our [*latest tutorial video*](https://www.youtube.com/watch?v=Q0TUT5vtEyg) on YouTube.

{% embed url="<https://www.youtube.com/watch?v=Q0TUT5vtEyg>" %}
Unleash the Power of Convai AI NPCs in Your Unity VR Game
{% endembed %}

### Method 1 : Automatic Setup

{% hint style="success" %}
Recommended for new projects.
{% endhint %}

{% hint style="danger" %}
The following processes will be performed:

* Universal Render Pipeline (URP)
* OpenXR Plugin
* XR Interaction Toolkit
* Convai Custom VR Package
* Convai URP Converter

**If these packages are not present, they will be installed.**
{% endhint %}

{% hint style="danger" %}
**If the target build platform is not Android, it will be switched to&#x20;*****Android.***
{% endhint %}

{% hint style="warning" %}
Make sure to download the Android platform support from Unity Hub for your project's version.
{% endhint %}

1. Click on " *Convai / Convai Custom Package Installer / Install VR Package* "

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2F21bOM5YePk9F46dEKSkr%2FConvaiCustomPackageInstaller.png?alt=media&#x26;token=c20d32f6-aff5-459f-8213-e0ce83bc8f1d" alt=""><figcaption></figcaption></figure>

2. Confirm the changes and processes to be made. If you agree, the process will start.                     Click " **Yes, Proceed** " and the process will begin. You'll see logs in the console.

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FGy6nnyA0L2vgaXXLQkF9%2FConvaiCustomPackageInstallerConfirmWindow.png?alt=media&#x26;token=2ae378ec-0aac-4b34-b377-6db86af7b013" alt=""><figcaption></figcaption></figure>

3. If you encounter an error like " Failed to Resolve Packages " don't worry. The process will continue and the error will be resolved automatically after the package installations are complete.

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FPfhlasAaDsBnTIckCmct%2FVRLogs.png?alt=media&#x26;token=8dff5c2d-7331-4815-9254-34022be73dd3" alt=""><figcaption></figcaption></figure>

4. Open the " *Convai / Scenes / Convai Demo - VR* " demo scene. If the TMP Importer window appears, click " **Import TMP Essentials** " to install TextMeshPro for UI text objects.

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2F69nbgYYrti9eBL9Ogfbo%2FAutomaticallyImportTMPEssentials.png?alt=media&#x26;token=31bdc58f-c282-4d6d-88db-8ff7ae9a1045" alt=""><figcaption></figcaption></figure>

Alternatively, you can use the " *Window / TextMeshPro / Import TMP Essential Resources* " to install it.

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2F22hL0PzDtgfJUMUbapkX%2FManualImportTMPEssentialsResources.png?alt=media&#x26;token=2fee2d5c-8622-419b-8069-6d7a643c6930" alt=""><figcaption></figcaption></figure>

5. Build your project by going to " *File /Build Settings / Build* " Ensure that the " **Convai Demo - VR** " scene is included in the Scenes in Build section.

Now everything is ready for testing. 🙂✅

{% hint style="warning" %}
Ensure you've set up your API Key. ( Convai / Convai Setup )
{% endhint %}

### Method 2 : Manual Setup&#x20;

{% hint style="danger" %}
Ensure you have the following packages installed in your project:

* OpenXR or Oculus XR
* XR Interaction Toolkit
* URP (Universal Render Pipeline)
  {% endhint %}

1. Double-click on " *Convai / Convai Custom Unity Packages / ConvaiVRUpgrader.unitypackage* "

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FJi7Q2eCxi2i4rV46woxo%2FConvaiVRUpgrader.png?alt=media&#x26;token=48c6c18c-0d43-479d-9979-e543c4ad29dc" alt=""><figcaption></figcaption></figure>

2. You'll see a warning that the settings will overwrite your project settings. You can either allow it by clicking " **Import** " or create a temporary project by clicking " **Switch Project** "

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FO3QHQ8judZcL0A8Y7srx%2FVRUpgraderWarning.png?alt=media&#x26;token=73944c2f-6c54-4cb5-bb44-dad6e2d8e146" alt=""><figcaption></figcaption></figure>

3. In the Import Unity Package window, review the assets to be imported and click " **Next** "

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2Fl5JBO61zZxrz5i3T907b%2FConvaiVRUpgraderimport_1.png?alt=media&#x26;token=3275b9f6-bb6e-4b4d-88ba-2104a944b701" alt=""><figcaption></figcaption></figure>

4. In this window, select the project settings you want to import and complete the installation by clicking " **Import** ".

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FRqtZy5z75gbM84isPgGw%2FConvaiVRUpgraderimport_2.png?alt=media&#x26;token=5d3ecc1f-d515-402e-a4ac-92711fbadb1d" alt=""><figcaption></figcaption></figure>

5. Open the " *Convai / Scenes/ Convai Demo - VR* " demo scene. If the TMP Importer window appears, click " **Import TMP Essentials** " to install TextMeshPro for UI text objects.

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2F69nbgYYrti9eBL9Ogfbo%2FAutomaticallyImportTMPEssentials.png?alt=media&#x26;token=31bdc58f-c282-4d6d-88db-8ff7ae9a1045" alt=""><figcaption></figcaption></figure>

6. If you see 3D objects in pink, it's a shader issue. If you're using URP, convert the materials to URP by double-clicking on " *Convai / Convai Custom Unity Packages / ConvaiURPConverter* " and importing all assets in the window that appears.

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FR9jINUQqbrd9jZp4SCYV%2FConvaiURPConverter.png?alt=media&#x26;token=25651447-64c9-44d4-890b-0ab8823609eb" alt=""><figcaption></figcaption></figure>

7. Build your project by going to " *File / Build Settings / Build* " Ensure that the " **Convai Demo - VR** " scene is included in the Scenes in **Build** section.

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2Feu0juFyPC3bTreRVgyJl%2FVRBuildSettings.png?alt=media&#x26;token=7207776e-65a8-45d8-93cc-a60502a88c9d" alt=""><figcaption></figcaption></figure>

Now everything is ready for testing. 🙂✅

{% hint style="warning" %}
Ensure you've set up your API Key (Convai/Convai Setup).
{% endhint %}

### Convai Default VR Controller Scheme

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2Fzfuv4O5hF4aCq6kOdvl7%2FConvaiDefaultVRControllerScheme.png?alt=media&#x26;token=8d9a747a-cfd5-4592-9cce-dc5bac90aeea" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.convai.com/api-docs/plugins-and-integrations/unity-plugin/building-for-supported-platforms/building-for-vr.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
