Skip to content
Development
Skill

/event

Wire UnityEvent persistent listeners at editor time. 在编辑器期连接 UnityEvent 持久化监听器。

From plugin
unity-skills
1.6k74 skills5 commands
Install
$ npx -y skills add Besty0728/Unity-Skills --skill event --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/event

Context preview

The summary Claude sees to decide when to auto-load this skill.

Wire UnityEvent persistent listeners at editor time. 在编辑器期连接 UnityEvent 持久化监听器。

SKILL.md

event.SKILL.md
name: unity-event
description: Wire UnityEvent persistent listeners at editor time. 在编辑器期连接 UnityEvent 持久化监听器。

Triggers

  • Hooking up UnityEvents in the Inspector
  • Wiring button or trigger callbacks
  • Scripting persistent listeners
  • 在 Inspector 里挂接 UnityEvent、连接按钮或触发器回调、脚本化持久监听

Event Skills

Inspect and modify persistent listeners on UnityEvents (e.g. `Button.onClick`, `Toggle.onValueChanged`) — the same listeners you see in the Inspector's event drop slots.

Operating Mode

  • **Approval**:查询类 skill(`event_get_listeners` / `event_list_events` / `event_get_listener_count`,源码标 `SkillMode.SemiAuto`)直接执行;其余变更/调用类(`event_add_listener` / `event_set_listener` / `event_set_listener_state` / `event_invoke` / `event_add_listener_batch` / `event_copy_listeners`,标 `SkillMode.FullAuto`)需用户 grant,grant 后服务端一步执行返结果。
  • **Auto / Bypass**:未被禁列表拦截的 skill 直接执行。
  • 本模块**含 Delete 类 skill**:`event_remove_listener`、`event_clear_listeners` 标记为 `SkillOperation.Delete`,被 `IsForbiddenInSemi` 静态拦截 —— 仅 **Bypass** 模式或加入 **Allowlist** 才能调用。
  • `event_invoke` 只在 Play mode / runtime 下有效;编辑器空跑时仅触发 EditorAndRuntime 监听。`event_add_listener` 等写入的是 persistent listener(序列化到 prefab/scene),即可在编辑器时配置。

**DO NOT** (common hallucinations):

  • `event_create` / `event_trigger` do not exist → UnityEvents are declared in component source code; this module only wires listeners
  • `event_subscribe` does not exist → use `event_add_listener`
  • `event_remove` does not exist → use `event_remove_listener`
  • `event_add_listener` requires exact component type and method name on the target

**Routing**:

  • For XR interaction events → use `xr` module's `xr_add_interaction_event`
  • For C# event code → write via `script` module

Skills

`event_get_listeners`

Get persistent listeners of a UnityEvent. **Parameters:**

  • `name` / `instanceId` / `path`: Target GameObject locator.
  • `componentName` (string): Component name.
  • `eventName` (string): Event field name (e.g. "onClick").

`event_add_listener`

Add a persistent listener to a UnityEvent (Editor time). **Parameters:**

  • `name` / `instanceId` / `path`, `componentName`, `eventName`: Target event.
  • `targetObjectName`, `targetComponentName`, `methodName`: Method to call.
  • `mode` (string, optional): "RuntimeOnly", "EditorAndRuntime", "Off".
  • `argType` (string, optional): "void", "int", "float", "string", "bool".
  • `floatArg`, `intArg`, `stringArg`, `boolArg`: Argument value if needed.

`event_remove_listener`

Remove a persistent listener by index. **Parameters:**

  • `name` / `instanceId` / `path`, `componentName`, `eventName`: Target event.
  • `index` (int): Listener index.

`event_invoke`

Invoke a UnityEvent explicitly (Runtime only). **Parameters:**

  • `name` / `instanceId` / `path`, `componentName`, `eventName`: Target event.

`event_clear_listeners`

Remove all persistent listeners from a UnityEvent.

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | name | string | No | null | GameObject name | | instanceId | int | No | 0 | GameObject instance ID | | path | string | No | null | GameObject hierarchy path | | componentName | string | No | null | Component name | | eventName | string | No | null | Event field name (e.g. "onClick") |

**Returns:** `{ success, removed }`

`event_set_listener_state`

Set a listener's call state (Off, RuntimeOnly, EditorAndRuntime).

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | name | string | No | null | GameObject name | | instanceId | int | No | 0 | GameObject instance ID | | path | string | No | null | GameObject hierarchy path | | componentName | string | No | null | Component name | | eventName | string | No | null | Event field name | | index | int | No | 0 | Listener index | | state | string | No | null | Call state: "Off", "RuntimeOnly", or "EditorAndRuntime" |

**Returns:** `{ success, index, state }`

`event_set_listener`

Replace a persistent listener at a specific index.

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | name | string | No | null | GameObject name | | instanceId | int | No | 0 | GameObject instance ID | | path | string | No | null | GameObject hierarchy path | | componentName | string | No | null | Source component name | | eventName | string | No | null | Event field name | | index | int | No | 0 | Listener index to replace | | targetName | string | No | null | Target GameObject name | | targetInstanceId | int | No | 0 | Target GameObject instance ID | | targetPath | string | No | null | Target hierarchy path | | targetComponentName | string | No | null | Target component name, or `GameObject` | | methodName | string | No | null | Public method or `set_PropertyName` | | mode | string | No | RuntimeOnly | Off, RuntimeOnly, or EditorAndRuntime | | argType | string | No | void | void, int, float, string, bool, object | | floatArg | float | No | 0 | Static float argument | | intArg | int | No | 0 | Static int argument | | stringArg | string | No | null | Static string argument | | boolArg | bool | No | false | Static bool argument | | objectReferenceName | string | No | null | Scene object argument name | | objectReferenceInstanceId | int | No | 0 | Scene object argument instance ID | | objectReferencePath | string | No | null | Scene object argument path | | objectAssetPath | string | No | null | Project asset argument path | | objectType | string | No | null | Object/component type for object argument |

**Returns:** `{ success, index, target, targetType, method, state, argType }`

`event_list_events`

List all UnityEvent fields on a component.

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | name | string | No | null | GameObject name | | instanceId | int | No | 0 | GameObject instance ID | | path | string | No | null | GameObject hierarch

Read more
Ships withunity-skills

REST API-based AI-driven Unity Editor Automation Engine Let AI control Unity scenes directly through Skills 🎉 We are now indexed by DeepWiki! Got questions? Check out the AI-generated docs → The current official maintenance baseline is Unity 2022.3+.

Get the whole plugin