# 导入ARDK及配置

## 导入ARDK

RayNeo OpenXR ARDK 是核心 AR功能，组件，插件的集合，可简化和增强 Unity 中应用程序的开发过程。它打包了几个重要的 SDK，为您的应用提供立体渲染，头控，操作等开发支持。

### 下载导入

[ARDK 下载](/rayneo-devdoc/x-xi-lie/unity-kai-fa/ardk-xia-zai.md)

### 导入步骤

1.创建Unity空工程

2.在工程中Windows->PackageManager

<figure><img src="/files/oGzgeRM6r1OLH79f2fIg" alt=""><figcaption></figcaption></figure>

3.选择RayNeo ARDK 中的package.json并打开

<figure><img src="/files/TAVs006Kh6CIcO1wvOIU" alt=""><figcaption></figcaption></figure>

### 导入后的步骤

1.导入Rayneo ARDK后，会提示你使用了新输入系统事件

<figure><img src="/files/C2MOAEG79RzfOZph9Qsr" alt=""><figcaption></figcaption></figure>

此时我们选Yes，等待工程重启<br>

## 配置设置（重要）

本文可帮助您优化程序性能和质量，并利用Rayneo ARDK功能简化开发过程的基本设置。<mark style="color:red;">我们建议您按照本指南中的说明应用这些设置</mark>。

### 设置目标平台

1.在菜单栏上，转到File>Build Settings。

2.在平台下，选择Android。

3.单击切换平台。注意：

* 测试和调试应用程序时：请选择Development Build
* **当您准备好进行Release 构建时：请清除选择**，因为它可能会影响应用程序的性能。

<figure><img src="/files/lbqiB5Oxvg8EnWbdq2x1" alt=""><figcaption></figcaption></figure>

### 通用设置

1.在菜单上，转到Edit>Project Settings>Player，然后展开Other Settings选项卡。

2.在Other Settings选项卡上的Identification下，选中Override Default Package Name，并填写包名

<figure><img src="/files/Oia4qjSHcErbOG9xJGqA" alt=""><figcaption></figcaption></figure>

3.进入Project Settings->XR Plug-in Management,勾选OpenXR 和 RayNeo XR feature group

<figure><img src="/files/YW9HIxRvvsKVIqiOjsZd" alt=""><figcaption></figcaption></figure>

4.点击OpenXR后面红色感叹号.进入参数设置.选择Fix All

<figure><img src="/files/lbHj1QXUwxRh6CYWxrvp" alt=""><figcaption></figcaption></figure>

### 必要配置（必看）

#### 配置 AndroidManifest.xml

> **该配置将决定app是否以正确的方式启动，否则启动时将会被识别为“手机应用”，要求连接戒指或手机射线**

1.在菜单上，转到Edit>Project Settings>Player，然后展开Publish Settings选项卡。

2.在Publish Settings选项卡上的Build下，勾选Custom Main Manifest

随后可在Unity>Project>Plugin>Android 文件夹下，找到自动生成的AndroidManifest.xml

<figure><img src="/files/HbbfSG2Tnd0L9lZHOp9Z" alt=""><figcaption></figcaption></figure>

3.修改 AndroidManifest.xml 文件&#x20;

SDK 定义的 UnityOpenXrActivity作为启动 Activity，

需要将启动 Activity 设置为 com.rayneo.openxradapter.UnityOpenXrActivity

```xml
<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.unity3d.player"
    xmlns:tools="http://schemas.android.com/tools">
    <application>
        <activity android:name="com.rayneo.openxradapter.UnityOpenXrActivity"
                  android:theme="@style/UnityThemeSelector">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
        </activity>
      <meta-data android:name="com.rayneo.mercury.app" android:value="true" />
   
    </application>
</manifest>
```

<br>

#### 头控模式选择

当前头控支持三种模式三选一，调用对应能力，均需选择对应模式

* **SLAM模式**：适用6dof、人脸检测、平面检测等功能
* **DOF3**：适用常规3dof
* **DOF\_WITH\_ABSOLUTE\_ORIENTATION**：适用3dof+磁力计绑定功能

\
**如何配置**

* 进入BuildSettings->XR Plug-in Management-> OpenXR ->RayNeoSupport 的设置.
* 将Camera Attitude Type设置为对应模式,即可在启动应用时自动响应

<figure><img src="/files/kpCheDL6OI4Pa639V3Xd" 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://rayneo.gitbook.io/rayneo-devdoc/x-xi-lie/unity-kai-fa/kuai-su-kai-shi/dao-ru-ardk-ji-pei-zhi.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.
