AgentSkillsCN

unity-importer

获取并设置纹理、音频和模型的导入设置。对于2个及以上资源,可使用*_batch技能。

SKILL.md
--- frontmatter
name: unity-importer
description: "Get and set import settings for Textures, Audio, and Models. Use *_batch skills for 2+ assets."

Unity Importer Skills

BATCH-FIRST: Use *_batch skills when configuring 2+ assets.

Skills Overview

Single ObjectBatch VersionUse Batch When
texture_set_settingstexture_set_settings_batchConfiguring 2+ textures
audio_set_settingsaudio_set_settings_batchConfiguring 2+ audio files
model_set_settingsmodel_set_settings_batchConfiguring 2+ models

Query Skills (no batch needed):

  • texture_get_settings - Get texture import settings
  • audio_get_settings - Get audio import settings
  • model_get_settings - Get model import settings

Texture Skills

texture_get_settings / texture_set_settings

ParameterTypeDescription
assetPathstringPath like Assets/Textures/icon.png
textureTypestringDefault, NormalMap, Sprite, EditorGUI, Cursor, Cookie, Lightmap, SingleChannel
maxSizeint32, 64, 128, 256, 512, 1024, 2048, 4096, 8192
filterModestringPoint, Bilinear, Trilinear
compressionstringNone, LowQuality, Normal, HighQuality
mipmapEnabledboolGenerate mipmaps
sRGBboolsRGB color space
readableboolCPU readable (for GetPixel)
spritePixelsPerUnitfloatPixels per unit for Sprite type
wrapModestringRepeat, Clamp, Mirror, MirrorOnce
python
# Single - convert to sprite
unity_skills.call_skill("texture_set_settings",
    assetPath="Assets/Textures/ui_button.png",
    textureType="Sprite",
    spritePixelsPerUnit=100,
    filterMode="Bilinear"
)

# Batch - convert multiple to sprites
unity_skills.call_skill("texture_set_settings_batch", items=[
    {"assetPath": "Assets/Textures/icon1.png", "textureType": "Sprite"},
    {"assetPath": "Assets/Textures/icon2.png", "textureType": "Sprite"},
    {"assetPath": "Assets/Textures/icon3.png", "textureType": "Sprite"}
])

Audio Skills

audio_get_settings / audio_set_settings

ParameterTypeDescription
assetPathstringPath like Assets/Audio/bgm.mp3
forceToMonoboolForce to mono channel
loadInBackgroundboolLoad in background thread
preloadAudioDataboolPreload on scene load
loadTypestringDecompressOnLoad, CompressedInMemory, Streaming
compressionFormatstringPCM, Vorbis, ADPCM
qualityfloat0.0 ~ 1.0 (Vorbis quality)
python
# BGM - use streaming for memory efficiency
unity_skills.call_skill("audio_set_settings",
    assetPath="Assets/Audio/bgm.mp3",
    loadType="Streaming",
    compressionFormat="Vorbis",
    quality=0.7
)

# SFX - decompress for low latency
unity_skills.call_skill("audio_set_settings",
    assetPath="Assets/Audio/sfx_hit.wav",
    loadType="DecompressOnLoad",
    forceToMono=True
)

# Batch
unity_skills.call_skill("audio_set_settings_batch", items=[
    {"assetPath": "Assets/Audio/sfx1.wav", "loadType": "DecompressOnLoad"},
    {"assetPath": "Assets/Audio/sfx2.wav", "loadType": "DecompressOnLoad"}
])

Model Skills

model_get_settings / model_set_settings

ParameterTypeDescription
assetPathstringPath like Assets/Models/char.fbx
globalScalefloatImport scale factor
meshCompressionstringOff, Low, Medium, High
isReadableboolCPU readable mesh data
generateSecondaryUVboolGenerate lightmap UVs
importBlendShapesboolImport blend shapes
importCamerasboolImport cameras
importLightsboolImport lights
animationTypestringNone, Legacy, Generic, Humanoid
importAnimationboolImport animations
materialImportModestringNone, ImportViaMaterialDescription, ImportStandard
python
# Character with humanoid animation
unity_skills.call_skill("model_set_settings",
    assetPath="Assets/Models/character.fbx",
    animationType="Humanoid",
    meshCompression="Medium",
    generateSecondaryUV=True
)

# Static prop - optimize
unity_skills.call_skill("model_set_settings",
    assetPath="Assets/Models/prop_barrel.fbx",
    animationType="None",
    importAnimation=False,
    importCameras=False,
    importLights=False,
    meshCompression="High"
)

# Batch
unity_skills.call_skill("model_set_settings_batch", items=[
    {"assetPath": "Assets/Models/prop1.fbx", "animationType": "None", "meshCompression": "High"},
    {"assetPath": "Assets/Models/prop2.fbx", "animationType": "None", "meshCompression": "High"}
])

Example: Efficient Asset Configuration

python
import unity_skills

# BAD: 5 API calls
unity_skills.call_skill("texture_set_settings", assetPath="Assets/UI/btn1.png", textureType="Sprite")
unity_skills.call_skill("texture_set_settings", assetPath="Assets/UI/btn2.png", textureType="Sprite")
unity_skills.call_skill("texture_set_settings", assetPath="Assets/UI/btn3.png", textureType="Sprite")
unity_skills.call_skill("texture_set_settings", assetPath="Assets/UI/btn4.png", textureType="Sprite")
unity_skills.call_skill("texture_set_settings", assetPath="Assets/UI/btn5.png", textureType="Sprite")

# GOOD: 1 API call
unity_skills.call_skill("texture_set_settings_batch", items=[
    {"assetPath": f"Assets/UI/btn{i}.png", "textureType": "Sprite", "mipmapEnabled": False}
    for i in range(1, 6)
])

Best Practices

Textures

  • Use Sprite type for UI images
  • Disable mipmaps for UI textures to save memory
  • Use Point filter for pixel art
  • Set readable=false unless you need CPU access

Audio

  • Use Streaming for long BGM tracks
  • Use DecompressOnLoad for short SFX
  • Use Vorbis compression with quality 0.5-0.7 for good balance

Models

  • Use Humanoid animation type for characters with retargeting
  • Disable unused imports (cameras, lights) for props
  • Enable generateSecondaryUV for static objects using baked lighting