0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WorldSpaceUIDocument について

Posted at

UnityでUIを板ポリで出したかった。

これはメモです。

UI Documentというものがある。UnityのUIをhtmlっぽい感じで書けるのだが、このUIを全画面表示ではなく、RenderTextureなどに出力して3DオブジェクトのQuadに貼り付けて使いたい。Canvasで例えるなら、worldSpaceにしたい。

失敗した方法

uiDocument.panelSettings.SetScreenToPanelSpaceFunction

でScreenからpanelへの変換部分のアルゴリズムを変えることができるが、自分で実装したが力が及ばず、変な挙動をした。
image.png

成功した方法

Quadを作成し、以下スクリプトをアタッチ。足りないコンポーネントを作成して終了
https://gist.github.com/Anthelmed/5fcc49a402ad5c81136c73ce96ba004f

Unity_BCzQV9stm3.gif

以上、メモ

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?