- Mastering UI Development with Unity
- Ashley Godbold
- 239字
- 2021-08-27 18:43:13
Graphic Raycaster component
The Graphic Raycaster allows you to check to see whether objects on the Canvas have been hit by a user input using the EventSystem. As discussed when looking at the World Space Canvas Render Mode, when a user touches the screen, a ray is cast forward from the point on the screen at which the player touches. The Graphic Raycaster checks these rays and sees if they hit something on the Canvas.

You can adjust the following properties on the Graphic Raycaster component:
- Ignore Reversed Graphics: If a UI element is facing away from the player, having this selected will stop the hit from registering. If it is not selected, hits will register on back-facing UI objects.
- Blocking Objects: This setting specifies which types of items in front of it will block it from being hit. So, if you select Two D, any Two D object in front of the items on this Canvas will stop the items from being interacted with. However, 3D objects will not stop the interaction. The possible options are shown here:
- Blocking Mask: Selecting items on this property works similar to the Blocking Objects property. This allows you to select items based on their Rendering Layer, so you can get a little more specific. The possible options are shown as follows:
We will discuss Raycasting and the EventSystem more thoroughly in Chapter 4, The Event System and Programming for UI.
推薦閱讀
- The Modern C++ Challenge
- jQuery EasyUI網站開發實戰
- Xcode 7 Essentials(Second Edition)
- C語言程序設計案例式教程
- 微信公眾平臺開發:從零基礎到ThinkPHP5高性能框架實踐
- 編譯系統透視:圖解編譯原理
- Responsive Web Design by Example
- 精通Python設計模式(第2版)
- Python數據結構與算法(視頻教學版)
- Python之光:Python編程入門與實戰
- Mastering Unity 2D Game Development(Second Edition)
- iOS自動化測試實戰:基于Appium、Python與Pytest
- MINECRAFT編程:使用Python語言玩轉我的世界
- Advanced UFT 12 for Test Engineers Cookbook
- 從0到1:HTML5 Canvas動畫開發