Breakroom is now Sinewave Campus. Book a meeting

SUIRaycastResult

العميلالأنواع
في هذا الصنفClear
  1. الدوال
  2. Clear
  3. ToString
  4. الخصائص
  5. Distance
  6. Index
  7. Depth
  8. SortingLayer
  9. SortingOrder
  10. WorldPosition
  11. WorldNormal
  12. ScreenPosition
  13. GameObject
  14. IsValid
الأعضاء 12
دالةClearReset all the parameters of this RaycastResult
دالةToStringConverts all the properties of this UIRaycastResult into a string
خاصيةDistanceReturns the distance of the Raycast result
خاصيةIndexReturns the Index of the Raycast result
خاصيةDepthReturns the Depth of the Raycast result
خاصيةSortingLayerReturns the Sorting Layer of the Raycast result
خاصيةSortingOrderReturns the Sorting Order of the Raycast result
خاصيةWorldPositionReturns the World Position vector of the Raycast result
خاصيةWorldNormalReturns the World Normal vector of the Raycast result
خاصيةScreenPositionReturns the Screen Position vector of the Raycast result
خاصيةGameObjectReturns a reference to the GameObject of the Raycast result
خاصيةIsValidReturns whether the Raycast hit a valid UI Raycast target.

الدوال​

Clear​

void Clear()

Reset all the parameters of this RaycastResult

القيم المرجعة

void

مثال

Lua
Result = Space.UI.Raycast()
Result.Clear()

ToString​

string ToString()

Converts all the properties of this UIRaycastResult into a string

القيم المرجعة

string

مثال

Lua
Result = Space.UI.Raycast().ToString()
Lua
--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)

الخصائص​

Distanceللقراءة فقط​

float Distance {get; }

Returns the distance of the Raycast result

مثال

Lua
Result = Distance = Space.UI.Raycast().Distance
Lua
--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)

Indexللقراءة فقط​

float Index {get; }

Returns the Index of the Raycast result

مثال

Lua
Index= Space.UI.Raycast().Index
Lua
--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)

Depthللقراءة فقط​

int Depth {get; }

Returns the Depth of the Raycast result

مثال

Lua
Depth= Space.UI.Raycast().Depth
Lua
--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)

SortingLayerللقراءة فقط​

int SortingLayer {get; }

Returns the Sorting Layer of the Raycast result

مثال

Lua
SortingLayer= Space.UI.Raycast().SortingLayer
Lua
--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)

SortingOrderللقراءة فقط​

int SortingOrder {get; }

Returns the Sorting Order of the Raycast result

مثال

Lua
SortingOrder= Space.UI.Raycast().SortingOrder
Lua
--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)

WorldPositionللقراءة فقط​

SVector WorldPosition {get; }

Returns the World Position vector of the Raycast result

مثال

Lua
WorldPosition= Space.UI.Raycast().WorldPosition
Lua
--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)

WorldNormalللقراءة فقط​

SVector WorldNormal {get; }

Returns the World Normal vector of the Raycast result

مثال

Lua
WorldNormal= Space.UI.Raycast().WorldNormal
Lua
--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)

ScreenPositionللقراءة فقط​

SVector ScreenPosition {get; }

Returns the Screen Position vector of the Raycast result

مثال

Lua
ScreenPosition= Space.UI.Raycast().ScreenPosition
Lua
--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)

GameObjectللقراءة فقط​

SGameObject GameObject {get; }

Returns a reference to the GameObject of the Raycast result

مثال

Lua
GameObject= Space.UI.Raycast().GameObject
Lua
--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)

IsValidللقراءة فقط​

bool IsValid {get; }

Returns whether the Raycast hit a valid UI Raycast target. This will be true if the Raycast hits an element on Sinespace's UI

مثال

Lua
IsValid= Space.UI.Raycast().IsValid
Lua
--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)