Breakroom is now Sinewave Campus. Book a meeting

SResource

ClientTypes
On this className
  1. Properties
  2. Name
  3. Type
  4. AsText
  5. AsGameObject
  6. AsMaterial
  7. TextureWidth
  8. TextureHeight
Members 7
PropertyNameReturns the name of the resource as entered in the scripting runtime
PropertyTypeReturns the type of the resource as a string
PropertyAsTextConverts the resource's type from SResource type to string
PropertyAsGameObject–
PropertyAsMaterialConverts the resource's type from SResource to SMaterial
PropertyTextureWidthReturns the Texture Width of this resource
PropertyTextureHeightReturns the Texture Height of this resource

Properties​

NameRead only​

string Name {get; }

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

Example

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

TypeRead only​

string Type {get; }

Returns the type of the resource as a string

Example

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

AsTextRead only​

string AsText {get; }

Converts the resource's type from SResource type to string

Example

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

AsGameObjectRead only​

SGameObject AsGameObject {get; }

Example

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

AsMaterialRead only​

SMaterial AsMaterial {get; }

Converts the resource's type from SResource to SMaterial

Example

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

TextureWidthRead only​

float TextureWidth {get; }

Returns the Texture Width of this resource

Example

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

TextureHeightRead only​

float TextureHeight {get; }

Returns the Texture Height of this resource

Example

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