Filter raycasts by the alpha
and proportion
inside the viewport
.
More...
Inherits MonoBehaviour, and ICanvasRaycastFilter.
|
RectTransform | viewport |
| The viewport contains this to calculate the proportion. More...
|
|
float | threshold |
| The minimum visibility to pass raycasts. More...
|
|
int | sample = 10 |
| The sampling frequency to calculate the proportion when this rotates relative to the viewport . More...
|
|
|
Graphic | graphic [get] |
| Get the UnityEngine.UI.Graphic with this, throw exception if none. More...
|
|
float | alpha [get] |
| Get the alpha of the UnityEngine.UI.Graphic with this. More...
|
|
float | proportion [get] |
| Get the UnityEngine.RectTransform proportion inside the viewport . More...
|
|
float | visibility [get] |
| Get the visibility, i.e., the alpha multiply the proportion . More...
|
|
Filter raycasts by the alpha
and proportion
inside the viewport
.
bool IsRaycastLocationValid |
( |
Vector2 |
sp, |
|
|
Camera |
eventCamera |
|
) |
| |
Check if the raycast valid, i.e., the visibility
is over the threshold
.
- Parameters
-
sp | Screen position. |
eventCamera | Raycast camera. |
- Returns
true
if raycast valid; otherwise, false
.
The viewport contains this to calculate the proportion.
The minimum visibility to pass raycasts.
The sampling frequency to calculate the proportion when this rotates relative to the viewport
.
Get the UnityEngine.UI.Graphic
with this, throw exception if none.
Get the alpha of the UnityEngine.UI.Graphic
with this.
Get the UnityEngine.RectTransform
proportion inside the viewport
.
Use parent UnityEngine.UI.Mask
or UnityEngine.Canvas
instead of viewport
if not set. Or return 0 if there's none of the above.
Get the visibility, i.e., the alpha
multiply the proportion
.
Only valid when the graphic
is active and enabled in the hierarchy, otherwise return 0.