SResource
客户端类型
成员 7
| 属性 | Name | Returns the name of the resource as entered in the scripting runtime |
| 属性 | Type | Returns the type of the resource as a string |
| 属性 | AsText | Converts the resource's type from SResource type to string |
| 属性 | AsGameObject | – |
| 属性 | AsMaterial | Converts the resource's type from SResource to SMaterial |
| 属性 | TextureWidth | Returns the Texture Width of this resource |
| 属性 | TextureHeight | Returns 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只读
示例
Lua
GameObject = Space.GetResource("Resource Name").AsGameObject
AsMaterial只读
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



