简体   繁体   中英

New UI Builder/Toolkit & VR World Space

Is it possible to use the new UI builder and Toolkit for World Space UI in Virtual Reality use?

I have seen ways of doing it with Render Textures but not only does It not seem to be the same as a World Space Canvas (Which I did expect but it´s not even close) but I also don´t find a way of interacting using the VR Raycast method?

This isn't officially supported yet but is certainly possible for those willing to implement it themselves.

As the OP mentioned it is straightforward enough to render the UI, the main idea is to set panelSettings.targetTexture to some RenderTexture , which you can apply to a quad like any other texture. Note that if you have multiple UIs you will need multiple instances of PanelSettings .

For raycasting there is a method panelSettings.SetScreenToPanelSpaceFunction which can be used for translating 2d coordinates to panel coordinates, here is an Official Unity Sample demonstrating how it can be implemented in camera space. The method is called every update so it can be hijacked to use a raycast from a controller instead of screen coordinates, although I've had mixed results with this approach.

Check out this repo for an example implementation in XR, it is a more sophisticated solution which makes extended use of the input system.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM