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