# 眼镜2D UI制作

#### **前言**

在有些情况下需要在左右眼上全屏显示 UI,比如受到伤害时,周围会有一圈红晕

![](https://testopen.rayneo.cn/media/2dui-1.png)

#### **制作过程**

**创建 Canvas**

* 在场景下创建一个 Canvas.该 Canvas 的 Render Mode 为 Screen Space - Camera
* 将 Render Camera 设置为 XRPlugin 里的 Head(Head 上有 Camera)
* 删除 Canvas 上的 Graphic Raycaster

![](https://testopen.rayneo.cn/media/2dui-2.png)

**设定绘制区域**

* 在 Canvas 下,创建一个空节点,设定节点宽度为 1920,Anchor 为上下填充.(在示例中,节点名为 UIArea)
* 此时,UIArea 即为眼镜的 2DUI 绘制区域

![](https://testopen.rayneo.cn/media/2dui-3.png)

![](/files/AYKnqyhm2ST3mHeiSJCO)<br>


---

# 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/air-xi-lie/unity-kai-fa/api/yan-jing-2d-ui-zhi-zuo.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.
