gamedev-unity/skills/unity-skills/skills/light/SKILL.md
Create and configure Unity lights — Directional/Point/Spot/Area lights and batch-toggling scene lights. Use when adding or tuning lights, setting up scene lighting, or batch-enabling/disabling lights, even if the user just says "加个灯" or "打光". 创建与配置 Unity 灯光(Directional/Point/Spot/Area 灯光、批量开关场景灯光);当用户要添加或调校灯光、布置场景照明、或批量启用/禁用灯光时使用。
npx skillsauth add bernatmv/ai-rules unity-lightInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
BATCH-FIRST: Use
*_batchskills when operating on 2+ lights.
light_create, light_set_properties, light_set_properties_batch, light_set_enabled, light_set_enabled_batch, light_add_probe_group, light_add_reflection_probe) need user grant; grant triggers a single server-side execution that returns the result.light_get_info, light_find_all, light_get_lightmap_settings) are SkillMode.SemiAuto — they run in all three modes without grant.gameobject_delete from the gameobject module.DO NOT (common hallucinations):
light_add does not exist → use light_create (creates a new light GameObject)light_set_color / light_set_intensity do not exist → use light_set_properties (sets color, intensity, range, shadows together)light_delete does not exist → use gameobject_delete on the light's GameObjectlight_set_shadow does not exist → use light_set_properties with shadows parameter ("none"/"hard"/"soft")Routing:
light_get_lightmap_settings (this module)light_add_reflection_probe (this module)light_add_probe_group (this module)Object Targeting: All single-object skills accept
name(string) andinstanceId(int, preferred). Provide at least one.path(hierarchy path) is also accepted where noted.
| Single Object | Batch Version | Use Batch When |
|---------------|---------------|----------------|
| light_set_properties | light_set_properties_batch | Configuring 2+ lights |
| light_set_enabled | light_set_enabled_batch | Toggling 2+ lights |
No batch needed:
light_create - Create a lightlight_get_info - Get light informationlight_find_all - Find all lights (returns list)light_add_probe_group - Add a Light Probe Group with optional grid layoutlight_add_reflection_probe - Create a Reflection Probe at a positionlight_get_lightmap_settings - Inspect Lightmap baking settings| Type | Description | Use Case |
|------|-------------|----------|
| Directional | Parallel rays, no position | Sun, moon |
| Point | Omnidirectional from a point | Torches, bulbs |
| Spot | Cone-shaped beam | Flashlights, spotlights |
| Area | Rectangle/disc (baked only) | Windows, soft lights |
Create a new light.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| name | string | No | "New Light" | Light name |
| lightType | string | No | "Point" | Directional/Point/Spot/Area |
| x, y, z | float | No | 0,3,0 | Position |
| r, g, b | float | No | 1,1,1 | Color (0-1) |
| intensity | float | No | 1 | Light intensity |
| range | float | No | 10 | Range (Point/Spot) |
| spotAngle | float | No | 30 | Cone angle (Spot only) |
| shadows | string | No | "soft" | none/hard/soft |
Returns: {success, name, instanceId, lightType, position, color, intensity, shadows}
Configure light properties.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| name | string | No* | Light object name |
| instanceId | int | No* | Instance ID (preferred) |
| r, g, b | float | No | Color (0-1) |
| intensity | float | No | Light intensity |
| range | float | No | Range (Point/Spot) |
| spotAngle | float | No | Cone angle (Spot only) |
| shadows | string | No | none/hard/soft |
Returns: {success, name, lightType, color, intensity, range, spotAngle, shadows}
Configure multiple lights. Each item accepts: name/instanceId/path (identifier) + r, g, b, intensity, range, shadows (all optional).
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| items | json string | Yes | - | JSON array of per-item objects (see example below) |
Returns: {success, totalItems, successCount, failCount, results: [{success, name}]}
unity_skills.call_skill("light_set_properties_batch", items=[
{"name": "Light1", "intensity": 2.0, "r": 1, "g": 0.9, "b": 0.8},
{"instanceId": 12345, "intensity": 1.5, "shadows": "soft"},
{"name": "Light3", "intensity": 2.0}
])
Enable or disable a light.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| name | string | No* | Light object name |
| instanceId | int | No* | Instance ID |
| enabled | bool | Yes | Enable state |
Enable or disable multiple lights.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| items | json string | Yes | - | JSON array of per-item objects (see example below) |
Returns: {success, totalItems, successCount, failCount, results: [{success, name, enabled}]}
unity_skills.call_skill("light_set_enabled_batch", items=[
{"name": "Torch1", "enabled": False},
{"name": "Torch2", "enabled": False},
{"name": "Torch3", "enabled": False}
])
Get detailed light information.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| name | string | No* | Light object name |
| instanceId | int | No* | Instance ID |
Returns: {name, instanceId, path, lightType, color, intensity, range, spotAngle, shadows, enabled, cullingMask, bounceIntensity}
Find all lights in scene.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| lightType | string | No | null | Filter by type |
| limit | int | No | 50 | Max results |
Returns: {count, lights: [{name, instanceId, path, lightType, intensity, enabled}]}
light_add_probe_groupAdd a Light Probe Group to a GameObject. Optional grid layout: gridX/gridY/gridZ (count per axis), spacingX/spacingY/spacingZ (meters between probes).
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| name | string | No | null | GameObject name |
| instanceId | int | No | 0 | Instance ID |
| path | string | No | null | Hierarchy path |
| gridX | int | No | 0 | Probe count on X axis |
| gridY | int | No | 0 | Probe count on Y axis |
| gridZ | int | No | 0 | Probe count on Z axis |
| spacingX | float | No | 2 | Meters between probes on X |
| spacingY | float | No | 1.5 | Meters between probes on Y |
| spacingZ | float | No | 2 | Meters between probes on Z |
Returns: { success, gameObject, probeCount, existed, hasGrid }
light_add_reflection_probeCreate a Reflection Probe at a position.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| probeName | string | No | "ReflectionProbe" | Probe name |
| x, y, z | float | No | 0,1,0 | Position |
| sizeX, sizeY, sizeZ | float | No | 10,10,10 | Probe box size |
| resolution | int | No | 256 | Cubemap resolution |
Returns: { success, name, instanceId, resolution, size }
light_get_lightmap_settingsGet Lightmap baking settings.
No parameters.
Returns: { success, bakedGI, realtimeGI, lightmapSize, lightmapPadding, isRunning, lightmapCount }
import unity_skills
# BAD: 4 API calls
unity_skills.call_skill("light_set_properties", name="Light1", intensity=2.0)
unity_skills.call_skill("light_set_properties", name="Light2", intensity=2.0)
unity_skills.call_skill("light_set_properties", name="Light3", intensity=2.0)
unity_skills.call_skill("light_set_properties", name="Light4", intensity=2.0)
# GOOD: 1 API call
unity_skills.call_skill("light_set_properties_batch", items=[
{"name": "Light1", "intensity": 2.0},
{"name": "Light2", "intensity": 2.0},
{"name": "Light3", "intensity": 2.0},
{"name": "Light4", "intensity": 2.0}
])
unity_skills.call_skill("light_create",
name="Sun", lightType="Directional",
r=1, g=0.95, b=0.85, intensity=1.2, shadows="soft"
)
Exact names, parameters, defaults, and returns are defined by GET /skills/schema or unity_skills.get_skill_schema(), not by this file.
development
Keyword research and validation with real search-demand data — never ship keywords from intuition alone. Probes Google Autocomplete per language (free, no account) to prove demand and discover the exact phrasing people type, checks SERPs for winnability, and uses Keyword Planner/Ahrefs/Semrush exports when the user has access. Activates when: choosing or reviewing SEO keywords, meta keywords, page titles, article topics or slugs, landing page copy targeting search, App Store/ASO keyword fields, multilingual keyword sets, 'what should we rank for', 'keyword analysis', or auditing why a page doesn't rank. Also invoke it as a validation pass whenever another skill or task produces a keyword list.
development
Automate YooAsset hot-update and asset bundles — build bundles, run Editor simulate builds, manage Collector groups, analyze BuildReport, and validate runtime. Use when building or simulating YooAsset bundles, configuring collectors, or validating hot-update assets, even if the user just says "热更" or "打AB包". 自动化 YooAsset 热更新与资源包(构建 bundle、编辑器模拟构建、管理 Collector 分组、分析 BuildReport、运行时校验);当用户要构建或模拟 YooAsset 资源包、配置 collector、或校验热更资源时使用。
development
Source-anchored design rules for YooAsset v2.3.18 — initialization, default-package shortcuts, play modes, asset handles, loading, updates, filesystem, build, and pitfalls. Use when writing or reviewing YooAsset code, initializing packages, loading assets via handles, setting up hot-update/download, or choosing a play mode, even if the user just says "热更" or "资源包". 为 YooAsset v2.3.18 提供源码锚定的设计规则(初始化、默认包快捷方式、运行模式、资源句柄、加载、更新、文件系统、构建、陷阱);当用户要编写或审查 YooAsset 代码、初始化 package、用句柄加载资源、配置热更/下载、或选择运行模式时使用。
data-ai
Last-resort guidance for safely hand-editing Unity serialized YAML (.unity/.prefab/.asset/.meta/ProjectSettings) — reference/fileID repair, GUID safety, and merge-conflict fixes. Use when REST cannot reach the change and YAML must be hand-edited — fixing m_Script GUIDs, broken fileID references, .meta files, or merge conflicts, even if the user just says "场景文件打不开" or "引用丢了". 安全手编 Unity 序列化 YAML(.unity/.prefab/.asset/.meta/ProjectSettings)的最后手段(引用/fileID 修复、GUID 安全、合并冲突修复);当 REST 无法触达、必须手编 YAML 时使用——修复 m_Script GUID、断裂 fileID 引用、.meta 文件或合并冲突。