# SScriptingEvents

**成员** 5

|      |                                 |                                                         |
| ---- | ------------------------------- | ------------------------------------------------------- |
| 函数 | [InvokeEvent](#invokeevent)     | Invoke the event with its name                          |
| 属性 | [Enabled](#enabled)             | Whether the scriptingEvents component is enabled or not |
| 属性 | [Events](#events)               | Returns a list of events                                |
| 属性 | [ComponentName](#componentname) | The name of this component.                             |
| 属性 | [GameObject](#gameobject)       | –                                                       |

## 函数

### InvokeEvent

void InvokeEvent(string name)

Invoke the event with its name

参数

| 名称 | 类型   | 默认值 |
| ---- | ------ | ------ |
| name | string | –      |

返回值

`void`

示例

**Lua**

```lua
Space.Host.ExecutingObject.Events.InvokeEvent("EventName")

```

## 属性

### Enabled

bool Enabled {get; set; }

Whether the scriptingEvents component is enabled or not

示例

**Lua**

```lua
Space.Host.ExecutingObject.Events.Enabled = true

```

### Events

string\[] Events {get; }

Returns a list of events

示例

**Lua**

```lua
eventNames = Space.Host.ExecutingObject.Events.Events

```

### ComponentName

string ComponentName {get; }

The name of this component.

示例

**Lua**

```lua
componentName = Space.Host.ExecutingObject.Events.ComponentName

```

### GameObject

[SGameObject](/docs/zh-Hans/scripting/client-scripting-api-reference/types/sgameobject.md) GameObject {get; }

示例

**Lua**

```lua
theGameObject = Space.Host.ExecutingObject.Events.GameObject

```
