Breakroom is now Sinewave Campus. Book a meeting

SScriptingResources

客户端组件
在此类中GetResource
  1. 函数
  2. GetResource
  3. 属性
  4. Enabled
  5. Resources
  6. GameObject
成员 4
函数GetResourceReturns the SResource with the specified name, or else returns nil if not found.
属性EnabledReturn whether the ScriptingResources component is Enabled or not
属性ResourcesReturns an array of all resources contained within this component.
属性GameObject–

函数​

GetResource​

SResource GetResource(string name)

Returns the SResource with the specified name, or else returns nil if not found.

参数

名称类型默认值
namestring–

返回值

SResource

示例

Lua
resource = Space.Host.ExecutingObject.Resources.GetResource("ResourceName")
Lua
local thisObject=Space.Host.ExecutingObject
local thisObjectResource=thisObject.Resources.GetResource("Test")
if thisObjectResource == nil then
Space.Log("That resource was not found.")
else
Space.Log("That resource exists and can be used.")
end

属性​

Enabled​

bool Enabled {get; set; }

Return whether the ScriptingResources component is Enabled or not

示例

Lua
Space.Host.ExecutingObject.Resources.Enabled = true

Resources只读​

SResource[] Resources {get; }

Returns an array of all resources contained within this component.

示例

Lua
arrayOfResources = Space.Host.ExecutingObject.Resources.Resources

GameObject只读​

SGameObject GameObject {get; }

示例

Lua
theGameObject = Space.Host.ExecutingObject.Resources.GameObject