Converts all the properties of this UIRaycastResult into a string
Parameter
Type
Description
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 elementthisObject = Space.Host.ExecutingObjectuiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting RuntimeOnUpdate=function()if Space.Input.GetMouseDown(0) ==truethen result = Space.UI.Raycast() if result.IsValid then uiText = result.ToString()endendendthisObject.OnUpdate(OnUpdate)
Properties
Distance
float Distanceget
Returns the distance of the Raycast result
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 elementthisObject = Space.Host.ExecutingObjectuiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting RuntimeOnUpdate=function()if Space.Input.GetMouseDown(0) ==truethen result = Space.UI.Raycast() if result.IsValid then uiText = result.DistanceendendendthisObject.OnUpdate(OnUpdate)
Index
float Indexget
Returns the Index of the Raycast result
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 elementthisObject = Space.Host.ExecutingObjectuiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting RuntimeOnUpdate=function()if Space.Input.GetMouseDown(0) ==truethen result = Space.UI.Raycast() if result.IsValid then uiText = result.IndexendendendthisObject.OnUpdate(OnUpdate)
Depth
int Depthget
Returns the Depth of the Raycast result
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 elementthisObject = Space.Host.ExecutingObjectuiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting RuntimeOnUpdate=function()if Space.Input.GetMouseDown(0) ==truethen result = Space.UI.Raycast() if result.IsValid then uiText = result.DepthendendendthisObject.OnUpdate(OnUpdate)
SortingLayer
int SortingLayerget
Returns the Sorting Layer of the Raycast result
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 elementthisObject = Space.Host.ExecutingObjectuiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting RuntimeOnUpdate=function()if Space.Input.GetMouseDown(0) ==truethen result = Space.UI.Raycast() if result.IsValid then uiText = result.SortingLayerendendendthisObject.OnUpdate(OnUpdate)
SortingOrder
int SortingOrderget
Returns the Sorting Order of the Raycast result
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 elementthisObject = Space.Host.ExecutingObjectuiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting RuntimeOnUpdate=function()if Space.Input.GetMouseDown(0) ==truethen result = Space.UI.Raycast() if result.IsValid then uiText = result.SortingOrderendendendthisObject.OnUpdate(OnUpdate)
Returns the World Position vector of the Raycast result
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 elementthisObject = Space.Host.ExecutingObjectuiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting RuntimeOnUpdate=function()if Space.Input.GetMouseDown(0) ==truethen result = Space.UI.Raycast() if result.IsValid then uiText = result.WorldPositionendendendthisObject.OnUpdate(OnUpdate)
Returns the World Normal vector of the Raycast result
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 elementthisObject = Space.Host.ExecutingObjectuiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting RuntimeOnUpdate=function()if Space.Input.GetMouseDown(0) ==truethen result = Space.UI.Raycast() if result.IsValid then uiText = result.WorldNormalendendendthisObject.OnUpdate(OnUpdate)
Returns the Screen Position vector of the Raycast result
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 elementthisObject = Space.Host.ExecutingObjectuiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting RuntimeOnUpdate=function()if Space.Input.GetMouseDown(0) ==truethen result = Space.UI.Raycast() if result.IsValid then uiText = result.ScreenPositionendendendthisObject.OnUpdate(OnUpdate)
Returns a reference to the GameObject of the Raycast result
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 elementthisObject = Space.Host.ExecutingObjectuiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting RuntimeOnUpdate=function()if Space.Input.GetMouseDown(0) ==truethen result = Space.UI.Raycast() if result.IsValid then uiText = result.GameObject.NameendendendthisObject.OnUpdate(OnUpdate)
IsValid
bool IsValidget
Returns whether the Raycast hit a valid UI Raycast target. This will be true if the Raycast hits an element on Sinespace's UI
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 elementthisObject = Space.Host.ExecutingObjectuiText = Space.Host.GetReference("text").UIText --Add this object with UIText component as reference in Scripting RuntimeOnUpdate=function()if Space.Input.GetMouseDown(0) ==truethen result = Space.UI.Raycast() if result.IsValid then uiText = result.ToString()endendendthisObject.OnUpdate(OnUpdate)