Breakroom is now Sinewave Campus. Book a meeting

SResource

العميلالأنواع
في هذا الصنفName
  1. الخصائص
  2. Name
  3. Type
  4. AsText
  5. AsGameObject
  6. AsMaterial
  7. TextureWidth
  8. TextureHeight
الأعضاء 7
خاصيةNameReturns the name of the resource as entered in the scripting runtime
خاصيةTypeReturns the type of the resource as a string
خاصيةAsTextConverts the resource's type from SResource type to string
خاصيةAsGameObject–
خاصيةAsMaterialConverts the resource's type from SResource to SMaterial
خاصيةTextureWidthReturns the Texture Width of this resource
خاصيةTextureHeightReturns the Texture Height of this resource

الخصائص​

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

string Name {get; }

Returns the name of the resource as entered in the scripting runtime

مثال

Lua
ResourceName = Space.Resources[1].Name
Lua
--the below script will search through the Scripting Runtime's resources
--and return the first instance of an Animation Clip
--[You need to add a few resources to the scripting runtime and make one of them an animation]


resources = Space.Resources

for i = 1, #resources do
if resources[i].Type == "AnimationClip" then
Space.Log("Resource #".. i .. " is an Animation Clip. The resource name is: " .. resources[i].Name)
break
end
end

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

string Type {get; }

Returns the type of the resource as a string

مثال

Lua
ResourceType = Space.GetResource("Resource Name").Type
Lua
--the below script will search through the Scripting Runtime's resources
--and return the first instance of an Animation Clip
--[You need to add a few resources to the scripting runtime and make one of them an animation]


resources = Space.Resources

for i = 1, #resources do
if resources[i].Type == "AnimationClip" then
Space.Log("Resource #".. i .. " is an Animation Clip. The resource name is: " .. resources[i].Name)
break
end
end

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

string AsText {get; }

Converts the resource's type from SResource type to string

مثال

Lua
Text = Space.GetResource("Resource Name").AsText

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

SGameObject AsGameObject {get; }

مثال

Lua
GameObject = Space.GetResource("Resource Name").AsGameObject

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

SMaterial AsMaterial {get; }

Converts the resource's type from SResource to SMaterial

مثال

Lua
Material = Space.GetResource("Resource Name").AsMaterial

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

float TextureWidth {get; }

Returns the Texture Width of this resource

مثال

Lua
TextureWidth = Space.GetResource("Resource Name").TextureWidth

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

float TextureHeight {get; }

Returns the Texture Height of this resource

مثال

Lua
TextureHeight = Space.GetResource("Resource Name").TextureHeight