SUIRaycastResult
Dans cette classeClear
| Fonction | Clear | Reset all the parameters of this RaycastResult |
| Fonction | ToString | Converts all the properties of this UIRaycastResult into a string |
| Propriété | Distance | Returns the distance of the Raycast result |
| Propriété | Index | Returns the Index of the Raycast result |
| Propriété | Depth | Returns the Depth of the Raycast result |
| Propriété | SortingLayer | Returns the Sorting Layer of the Raycast result |
| Propriété | SortingOrder | Returns the Sorting Order of the Raycast result |
| Propriété | WorldPosition | Returns the World Position vector of the Raycast result |
| Propriété | WorldNormal | Returns the World Normal vector of the Raycast result |
| Propriété | ScreenPosition | Returns the Screen Position vector of the Raycast result |
| Propriété | GameObject | Returns a reference to the GameObject of the Raycast result |
| Propriété | IsValid | Returns whether the Raycast hit a valid UI Raycast target. |
Fonctions
Clear
Reset all the parameters of this RaycastResult
Valeurs de retour
void
Exemple
Result = Space.UI.Raycast()
Result.Clear()
ToString
Converts all the properties of this UIRaycastResult into a string
Valeurs de retour
string
Exemple
Result = Space.UI.Raycast().ToString()
--This script will update a UIText element with the result of a UIRaycast whenever...
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime
OnUpdate = function()
if Space.Input.GetMouseDown(0) == true then
result = Space.UI.Raycast()
if result.IsValid then
uiText = result.ToString()
end
end
end
thisObject.OnUpdate(OnUpdate)
Propriétés
DistanceLecture seule
Returns the distance of the Raycast result
Exemple
Result = Distance = Space.UI.Raycast().Distance
--This script will update a UIText element with the Distance of the UIRaycast whenever
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime
OnUpdate = function()
if Space.Input.GetMouseDown(0) == true then
result = Space.UI.Raycast()
if result.IsValid then
uiText = result.Distance
end
end
end
thisObject.OnUpdate(OnUpdate)
IndexLecture seule
Returns the Index of the Raycast result
Exemple
Index= Space.UI.Raycast().Index
--This script will update a UIText element with the Index of the UIRaycast whenever
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime
OnUpdate = function()
if Space.Input.GetMouseDown(0) == true then
result = Space.UI.Raycast()
if result.IsValid then
uiText = result.Index
end
end
end
thisObject.OnUpdate(OnUpdate)
DepthLecture seule
Returns the Depth of the Raycast result
Exemple
Depth= Space.UI.Raycast().Depth
--This script will update a UIText element with the Depth of the UIRaycast whenever
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime
OnUpdate = function()
if Space.Input.GetMouseDown(0) == true then
result = Space.UI.Raycast()
if result.IsValid then
uiText = result.Depth
end
end
end
thisObject.OnUpdate(OnUpdate)
SortingLayerLecture seule
Returns the Sorting Layer of the Raycast result
Exemple
SortingLayer= Space.UI.Raycast().SortingLayer
--This script will update a UIText element with the Sorting Layer of the UIRaycast whenever
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime
OnUpdate = function()
if Space.Input.GetMouseDown(0) == true then
result = Space.UI.Raycast()
if result.IsValid then
uiText = result.SortingLayer
end
end
end
thisObject.OnUpdate(OnUpdate)
SortingOrderLecture seule
Returns the Sorting Order of the Raycast result
Exemple
SortingOrder= Space.UI.Raycast().SortingOrder
--This script will update a UIText element with the Sorting Order of the UIRaycast whenever
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime
OnUpdate = function()
if Space.Input.GetMouseDown(0) == true then
result = Space.UI.Raycast()
if result.IsValid then
uiText = result.SortingOrder
end
end
end
thisObject.OnUpdate(OnUpdate)
WorldPositionLecture seule
Returns the World Position vector of the Raycast result
Exemple
WorldPosition= Space.UI.Raycast().WorldPosition
--This script will update a UIText element with the World Position of the UIRaycast whenever
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime
OnUpdate = function()
if Space.Input.GetMouseDown(0) == true then
result = Space.UI.Raycast()
if result.IsValid then
uiText = result.WorldPosition
end
end
end
thisObject.OnUpdate(OnUpdate)
WorldNormalLecture seule
Returns the World Normal vector of the Raycast result
Exemple
WorldNormal= Space.UI.Raycast().WorldNormal
--This script will update a UIText element with the World Normal of the UIRaycast whenever
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime
OnUpdate = function()
if Space.Input.GetMouseDown(0) == true then
result = Space.UI.Raycast()
if result.IsValid then
uiText = result.WorldNormal
end
end
end
thisObject.OnUpdate(OnUpdate)
ScreenPositionLecture seule
Returns the Screen Position vector of the Raycast result
Exemple
ScreenPosition= Space.UI.Raycast().ScreenPosition
--This script will update a UIText element with the Screen Position of the UIRaycast whenever
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime
OnUpdate = function()
if Space.Input.GetMouseDown(0) == true then
result = Space.UI.Raycast()
if result.IsValid then
uiText = result.ScreenPosition
end
end
end
thisObject.OnUpdate(OnUpdate)
GameObjectLecture seule
Returns a reference to the GameObject of the Raycast result
Exemple
GameObject= Space.UI.Raycast().GameObject
--This script will update a UIText element with the name of the UIRaycast
--by accesing it's GameObject whenever the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime
OnUpdate = function()
if Space.Input.GetMouseDown(0) == true then
result = Space.UI.Raycast()
if result.IsValid then
uiText = result.GameObject.Name
end
end
end
thisObject.OnUpdate(OnUpdate)
IsValidLecture seule
Returns whether the Raycast hit a valid UI Raycast target. This will be true if the Raycast hits an element on Sinespace's UI
Exemple
IsValid= Space.UI.Raycast().IsValid
--This script will check if Raycast result is valid
--and update a UIText element with the result of a UIRaycast whenever
--the player clicks on a Sinespace UI element
thisObject = Space.Host.ExecutingObject
uiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting Runtime
OnUpdate = function()
if Space.Input.GetMouseDown(0) == true then
result = Space.UI.Raycast()
if result.IsValid then
uiText = result.ToString()
end
end
end
thisObject.OnUpdate(OnUpdate)



