官术网_书友最值得收藏!

World Space

The last rendering mode is World Space. This mode allows you to render UI elements as if they are physically positioned within the world.

In Screen Space-Overlay and Screen Space-Camera, you cannot adjust the properties of the Rect Transform component. The positions of UI elements within Canvases with those two rendering modes do not translate to world space coordinates and are instead relative to the screen and camera. However, when a Canvas is in World Space render mode, the values of the Rect Transform can be adjusted, because the coordinates of the UI elements are based on actual positions within the scene. These Canvases do not have to face a specified camera as the other two Canvas types do.

This mode requests an Event Camera, rather than a Rendering Camera as Screen Space-Camera mode requested. An Event Camera is different than a Rendering Camera. Since this Canvas is in the World Space, it will be rendered with the Main Camera, just as all the other objects that exist within the scene. The Event Camera is the camera that will receive events from the EventSystem. So, if items on this Canvas require interactions, you have to include an Event Camera. If the player won't be interacting with the items on the Canvas, you can leave this blank.

The reason you need to specify an Event Camera is ray casting. When the user clicks on or touches the screen, a ray (one-directional line) is cast infinitely forward from the point of click (or touch) into the scene. The direction it points in is determined based on the direction the camera is facing. Most of the time, you will set this as your Main Camera, because that is the direction in which the player will expect the events to occur.

When you have World Space selected, the following properties become available:

  • Event Camera: As stated earlier, the camera assigned to this slot determines which camera will receive the events of the Canvas
  • Sorting Layer: This property is the same as in Screen Space-Camera
  • Order in Layer: This property is the same as in Screen Space-Camera
主站蜘蛛池模板: 承德县| 三河市| 松桃| 万载县| 华蓥市| 巨鹿县| 丰宁| 绵竹市| 成都市| 罗源县| 连云港市| 正镶白旗| 伽师县| 龙川县| 湖南省| 永嘉县| 湟源县| 益阳市| 德化县| 屏山县| 广宗县| 黄山市| 新密市| 长治市| 信丰县| 随州市| 嘉义市| 阿拉善右旗| 彭水| 平定县| 扎鲁特旗| 陆良县| 施秉县| 永川市| 咸阳市| 台安县| 新河县| 大新县| 柯坪县| 泾川县| 探索|