AgentSkillsCN

unity-skills

Unity编辑器REST API。BATCH-FIRST:对于2个及以上对象,使用*_batch。

SKILL.md
--- frontmatter
name: unity-skills
description: "Unity Editor REST API. BATCH-FIRST: Use *_batch for 2+ objects."

Unity Skills API

RULE: 2+ objects → use *_batch skill (1 call vs N calls)

Batch Skills (Use First!)

Skillitems format
gameobject_create_batch[{name, primitiveType?, x?, y?, z?, parentName?}]
gameobject_delete_batch[{name?, instanceId?}] or ["name1","name2"]
gameobject_set_transform_batch[{name, posX?, posY?, posZ?, rotX?, rotY?, rotZ?, scaleX?, scaleY?, scaleZ?}]
gameobject_set_active_batch[{name, active}]
gameobject_set_parent_batch[{childName, parentName}]
gameobject_duplicate_batch[{name?, instanceId?}]
gameobject_rename_batch[{instanceId, newName}]
gameobject_set_layer_batch[{name, layer}]
gameobject_set_tag_batch[{name, tag}]
component_add_batch[{name, componentType}]
component_remove_batch[{name, componentType}]
component_set_property_batch[{name, componentType, propertyName, value}]
material_create_batch[{name, shaderName?, savePath?}]
material_assign_batch[{name, materialPath}]
material_set_colors_batch[{name?, path?, r, g, b, a?, intensity?}]
material_set_emission_batch[{name?, path?, r, g, b, intensity?}]
prefab_instantiate_batch[{prefabPath, x?, y?, z?, rotX?, rotY?, rotZ?, name?, parentName?}]
asset_import_batch[{sourcePath, destinationPath}]
asset_delete_batch[{path}]
asset_move_batch[{sourcePath, destinationPath}]
ui_create_batch[{type, name, parent?, text?, width?, height?, x?, y?}] type: Button/Text/Image/Panel/Slider/Toggle/InputField
script_create_batch[{scriptName, folder?, template?, namespace?}]
light_set_properties_batch[{name, intensity?, r?, g?, b?, range?, shadows?}]
light_set_enabled_batch[{name, enabled}]
texture_set_settings_batch[{assetPath, textureType?, maxSize?, filterMode?, compression?, mipmapEnabled?, spritePixelsPerUnit?}]
audio_set_settings_batch[{assetPath, loadType?, compressionFormat?, quality?, forceToMono?}]
model_set_settings_batch[{assetPath, animationType?, meshCompression?, importAnimation?}]

Single Skills

gameobject

SkillParameters
gameobject_createname?, primitiveType?, x?, y?, z?, parentName?
gameobject_deletename?, instanceId?, path?
gameobject_findname?, tag?, layer?, component?, useRegex?, limit? → returns list
gameobject_get_infoname?, instanceId?, path?
gameobject_set_transformname, posX?, posY?, posZ?, rotX?, rotY?, rotZ?, scaleX?, scaleY?, scaleZ?
gameobject_set_parentname, parentName
gameobject_set_activename, active
gameobject_duplicatename?, instanceId? → returns copyName, copyInstanceId
gameobject_renamename?, instanceId?, newName

primitiveType: Cube, Sphere, Capsule, Cylinder, Plane, Quad, Empty(null)

component

SkillParameters
component_addname, componentType
component_removename, componentType
component_listname → returns components[]
component_set_propertyname, componentType, propertyName, value
component_get_propertiesname, componentType

componentType: Rigidbody, BoxCollider, SphereCollider, CapsuleCollider, MeshCollider, CharacterController, AudioSource, Light, Camera, Animator, etc.

material

SkillParameters
material_createname, shaderName?, savePath?
material_assignname?, instanceId?, path?, materialPath
material_set_colorname?, path?, r, g, b, a?, propertyName?, intensity?
material_set_emissionname?, path?, r, g, b, intensity?, enableEmission?
material_set_texturename?, path?, texturePath, propertyName?
material_set_floatname?, path?, propertyName, value
material_set_intname?, path?, propertyName, value
material_set_vectorname?, path?, propertyName, x, y, z?, w?
material_set_keywordname?, path?, keyword, enable?
material_set_render_queuename?, path?, renderQueue
material_set_shadername?, path?, shaderName
material_set_texture_offsetname?, path?, propertyName?, x, y
material_set_texture_scalename?, path?, propertyName?, x, y
material_get_propertiesname?, path?
material_get_keywordsname?, path?
material_duplicatesourcePath, newName, savePath?

scene

SkillParameters
scene_createscenePath
scene_loadscenePath, additive?
scene_savescenePath?
scene_get_info(none) → name, path, isDirty, rootObjects
scene_get_hierarchymaxDepth? → hierarchy tree
scene_screenshotfilename?, width?, height?

light

SkillParameters
light_createname?, lightType?, x?, y?, z?, r?, g?, b?, intensity?, range?, spotAngle?, shadows?
light_set_propertiesname, r?, g?, b?, intensity?, range?, shadows?
light_get_infoname
light_find_alllightType?, limit? → returns list
light_set_enabledname, enabled

lightType: Directional, Point, Spot, Area | shadows: none, hard, soft

prefab

SkillParameters
prefab_creategameObjectName?, instanceId?, savePath
prefab_instantiateprefabPath, x?, y?, z?, name?, parentName?
prefab_applygameObjectName?, instanceId?
prefab_unpackgameObjectName?, instanceId?, completely?

asset

SkillParameters
asset_importsourcePath, destinationPath
asset_deleteassetPath
asset_movesourcePath, destinationPath
asset_duplicateassetPath
asset_findsearchFilter, searchInFolders?, limit? → returns paths
asset_create_folderfolderPath
asset_refresh(none)
asset_get_infoassetPath

searchFilter: t:Texture2D, t:Material, t:Prefab, t:AudioClip, t:Script, name, l:Label

ui

SkillParameters
ui_create_canvasname?, renderMode?
ui_create_panelname?, parent?, r?, g?, b?, a?, width?, height?
ui_create_buttonname?, parent?, text?, width?, height?, x?, y?
ui_create_textname?, parent?, text?, fontSize?, r?, g?, b?, a?, width?, height?
ui_create_imagename?, parent?, spritePath?, r?, g?, b?, a?, width?, height?
ui_create_inputfieldname?, parent?, placeholder?, width?, height?
ui_create_slidername?, parent?, minValue?, maxValue?, value?, width?, height?
ui_create_togglename?, parent?, label?, isOn?
ui_set_textname, text
ui_find_alluiType?, limit?

renderMode: ScreenSpaceOverlay, ScreenSpaceCamera, WorldSpace | uiType: Button, Text, Image, Panel, Slider, Toggle, InputField

script

SkillParameters
script_createscriptName, folder?, template?, namespace?
script_readscriptPath → content
script_deletescriptPath
script_find_in_filepattern, folder?, isRegex?, limit? → matches
script_appendscriptPath, content, atLine?

template: MonoBehaviour, ScriptableObject, Editor, EditorWindow

editor

SkillParameters
editor_play(none)
editor_stop(none)
editor_pause(none)
editor_selectgameObjectName?, instanceId?
editor_get_selection(none) → selected objects with instanceId
editor_get_contextincludeComponents?, includeChildren? → selection, assets, scene info
editor_undo(none)
editor_redo(none)
editor_get_state(none) → isPlaying, isPaused, isCompiling
editor_execute_menumenuPath
editor_get_tags(none)
editor_get_layers(none)

menuPath: "File/Save", "Edit/Play", "GameObject/Create Empty", "Assets/Refresh"

animator

SkillParameters
animator_create_controllername, folder?
animator_add_parametercontrollerPath, paramName, paramType, defaultValue?
animator_get_parameterscontrollerPath
animator_set_parametername, paramName, paramType, floatValue?/intValue?/boolValue?
animator_playname, stateName, layer?, normalizedTime?
animator_get_infoname
animator_assign_controllername, controllerPath
animator_list_statescontrollerPath, layer?

paramType: float, int, bool, trigger

shader

SkillParameters
shader_createshaderName, savePath, template?
shader_readshaderPath
shader_listfilter?, limit?

template: Unlit, Standard, Transparent

workflow (Persistent History)

SkillParameters
workflow_task_starttag, description?
workflow_task_end(none)
workflow_snapshot_objectname?, instanceId?
workflow_list(none)
workflow_revert_tasktaskId
workflow_delete_tasktaskId

console

SkillParameters
console_start_capture(none)
console_stop_capture(none)
console_get_logsfilter?, limit?
console_clear(none)
console_logmessage, type?

filter/type: Log, Warning, Error

validation

SkillParameters
validate_scenecheckMissingScripts?, checkMissingPrefabs?, checkDuplicateNames?
validate_find_missing_scriptssearchInPrefabs?
validate_fix_missing_scriptsdryRun? (default true)
validate_cleanup_empty_foldersrootPath?, dryRun? (default true)
validate_find_unused_assetsassetType?, limit?
validate_texture_sizesmaxRecommendedSize?, limit?
validate_project_structurerootPath?, maxDepth?

importer

SkillParameters
texture_get_settingsassetPath
texture_set_settingsassetPath, textureType?, maxSize?, filterMode?, compression?, mipmapEnabled?, sRGB?, readable?, spritePixelsPerUnit?, wrapMode?
audio_get_settingsassetPath
audio_set_settingsassetPath, forceToMono?, loadInBackground?, preloadAudioData?, loadType?, compressionFormat?, quality?
model_get_settingsassetPath
model_set_settingsassetPath, globalScale?, meshCompression?, isReadable?, generateSecondaryUV?, importBlendShapes?, importCameras?, importLights?, animationType?, importAnimation?, materialImportMode?

textureType: Default, NormalMap, Sprite, EditorGUI, Cursor, Cookie, Lightmap, SingleChannel filterMode: Point, Bilinear, Trilinear | compression: None, LowQuality, Normal, HighQuality loadType: DecompressOnLoad, CompressedInMemory, Streaming | compressionFormat: PCM, Vorbis, ADPCM animationType: None, Legacy, Generic, Humanoid | meshCompression: Off, Low, Medium, High

physics

SkillParameters
physics_raycastoriginX, originY, originZ, dirX, dirY, dirZ, maxDistance?, layerMask?
physics_check_overlapx, y, z, radius, layerMask?
physics_get_gravity(none)
physics_set_gravityx, y, z

camera

SkillParameters
camera_align_view_to_objectobjectName
camera_get_info(none)
camera_set_transformposX, posY, posZ, rotX, rotY, rotZ, size?, instant?
camera_look_atx, y, z

navmesh

SkillParameters
navmesh_bake(none)
navmesh_calculate_pathstartX, startY, startZ, endX, endY, endZ, areaMask?

timeline

SkillParameters
timeline_createname, folder?
timeline_add_audio_trackdirectorObjectName, trackName?
timeline_add_animation_trackdirectorObjectName, trackName?, bindingObjectName?

cinemachine

SkillParameters
cinemachine_create_vcamname
cinemachine_set_vcam_propertyvcamName, componentType, propertyName, value
cinemachine_set_targetsvcamName, followName?, lookAtName?

event

SkillParameters
event_get_listenersobjectName, componentName, eventName
event_add_listenerobjectName, componentName, eventName, targetObjectName, ...
event_invokeobjectName, componentName, eventName

project

SkillParameters
project_get_info(none)
project_list_shadersfilter?, limit?
project_get_quality_settings(none)

optimization

SkillParameters
optimize_texturesmaxTextureSize?, enableCrunch?, compressionQuality?
optimize_mesh_compressioncompressionLevel, filter?

profiler

SkillParameters
profiler_get_stats(none)

Notes

  • Response: {success: true/false, ...data} or {success: false, error: "message"}
  • All operations auto-revert on failure
  • After script_create, wait 3-5s for Unity recompile
  • Use instanceId (from editor_get_selection/editor_get_context) for guaranteed uniqueness
  • name? means use name OR instanceId OR path to identify object