Skip to content
Development
Skill

/event

Wire UnityEvent persistent listeners at editor time

From plugin
unity-skills
1.9k83 skills4 commands

Claude Code

$ npx -y skills add Besty0728/Unity-Skills --skill event --agent claude-code

SKILL.md

event.SKILL.md
name: unity-event
description: Wire UnityEvent persistent listeners at editor time

> **Before calling any skill in this module:** if you are about to call a skill with parameters guessed from its name or description, STOP — read this file (or fetch its schema via `GET /skills/recommend?includeSchema=true`) first. If you already have the parameter definitions from recommend/schema, you may proceed straight to dryRun.

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.

| 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 | Yes | - | Component name | | eventName | string | Yes | - | Event field name (e.g. "onClick") |

**Returns:** `{ success, gameObject, component, eventName, listenerCount, listeners }`

`event_add_listener`

Add a persistent listener to a UnityEvent (Editor time).

| 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 | Yes | - | Component owning the event | | eventName | string | Yes | - | Event field name (e.g. "onClick") | | targetObjectName | string | Yes | - | GameObject holding the method to call | | targetComponentName | string | No | null | Component on the target, or `GameObject` to call the object itself | | methodName | string | Yes | - | Public method or `set_PropertyName` | | mode | string | No | RuntimeOnly | Off, RuntimeOnly, or EditorAndRuntime | | argType | string | No | void | void, int, float, string, or bool | | 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 |

**Returns:** `{ success, message, index, mode }`

Unlike `event_set_listener`, this skill has no `object` `argType` — it only reaches the standard `UnityEvent` overloads.

`event_remove_listener`

Remove a persistent listener by 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 | Yes | - | Component name | | eventName | string | Yes | - | Event field name | | index | int | No | 0 | Listener index |

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

`event_invoke`

Invoke a UnityEvent explicitly (Runtime only).

| 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 | Yes | - | Component name | | eventName | string | Yes | - | Event field name |

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

`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 | Yes | - | Component name | | eventName | string | Yes | - | 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 | Yes | - | Component name | | eventName | string | Yes | - | Event field name | | index | int | No | 0 | Listener index | | state | string | No | null | Call state: "Off", "RuntimeOnly", or "E

Read more
@besty0728
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+.

Stars on GitHub

Momentum

stars in total
1.9k
Star history of Besty0728/Unity-Skills on GitHub, a chart by star-history.com

Other skills on unity-skills.

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills10d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about event.

Which coding agents can use event?
event installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.