unity-animation-sh-xuegy4
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "unity-animation-sh-xuegy4" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-787dad7058b859c92c377da6cdc05fbcca2ddb871585382f715b9dc46b033a4e. Verify the upstream source and version against https://skillhub.cn/skills/user_3c6cb52e/unity-animation-sh-xuegy4 before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
unity-animation-sh-xuegy4: A skill specialized for the Unity animation system to help AI agents efficiently perform related tasks.
Introduction source: third_party · user_3c6cb52e · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Control animation state with Unity 6's `Animator` and Animator Controllers: parameters, transitions, blend trees, layers, and humanoid IK. Targets **Unity 6 (6000.0 LTS)**.
- Audience
- Use when connecting animation clips into a state machine, driving them from script via parameters, blending locomotion (idle→walk→run), layering an upper-body action over movement, or adding foot/hand IK on a humanoid rig. Use when the project has `*.controller` (Animator Controller) and `*.anim` assets, or a rigged model with an Avatar. When *not* to use:** simple non-skeletal value tweens (UI fades, position lerps) are better done with a tween/coroutine — see `unity-csharp-scripting`. Timeline cutscenes are a separate tool. 2D sprite frame animation also uses the Animator but with sprite keyframes.
- Testing
- Not tested
Browse files
Frontmatter
name: Unity动画系统
slug: unity-animation
version: 1.0.0
displayName: Unity动画系统
description: >
Unity动画系统专用技能,帮助AI Agent高效完成相关任务。
summary: "Unity动画系统专用技能,帮助AI Agent高效完成相关任务。"
license: Apache-2.0
category: 游戏开发
framework:
- Claude Code
- Codex
- Hermes Agent
- OpenClaw
- QClaw
- WorkBuddy
platform: multi-platform
homepage: "https://github.com/1991513ccie-png"
repository: "https://github.com/1991513ccie-png"Unity Animation (Animator / Mecanim)
Control animation state with Unity 6's Animator and Animator Controllers: parameters,
transitions, blend trees, layers, and humanoid IK. Targets Unity 6 (6000.0 LTS).
When to use
- Use when connecting animation clips into a state machine, driving them from script via parameters, blending locomotion (idle→walk→run), layering an upper-body action over movement, or adding foot/hand IK on a humanoid rig.
- Use when the project has
*.controller(Animator Controller) and*.animassets, or a rigged model with an Avatar.
When not to use: simple non-skeletal value tweens (UI fades, position lerps) are better
done with a tween/coroutine — see unity-csharp-scripting. Timeline cutscenes are a separate
tool. 2D sprite frame animation also uses the Animator but with sprite keyframes.
Core workflow
- Add an
Animatorto the model and assign an Animator Controller; for a humanoid model, set its rig to Humanoid so it has an Avatar (enables retargeting and IK). - Define parameters on the controller —
Float(Speed),Bool(IsGrounded),Int,Trigger(Jump) — and states with transitions whose conditions read those parameters. - Set parameters from script, never poke states directly:
SetFloat,SetBool,SetInteger,SetTrigger. The state machine resolves transitions for you. - Blend continuous motion with a Blend Tree (one
Floatlike Speed drives idle↔walk↔run) instead of many discrete states + transitions. - Layer additive/override motion (e.g. an upper-body "aim" layer with an Avatar Mask) and
control its
layerWeight. - Verify in the Animator window during Play mode — the live state highlights and parameter values update, so you can see exactly which transition fired (or didn't).
Patterns
1. Drive locomotion + a one-shot action from script
using UnityEngine;
[RequireComponent(typeof(Animator))]
public class CharacterAnim : MonoBehaviour
{
private Animator _anim;
// Cache parameter hashes — faster and typo-proof vs string lookups every frame.
private static readonly int Speed = Animator.StringToHash("Speed");
private static readonly int IsGrounded= Animator.StringToHash("IsGrounded");
private static readonly int Jump = Animator.StringToHash("Jump");
private void Awake() => _anim = GetComponent<Animator>();
public void Tick(float planarSpeed, bool grounded)
{
_anim.SetFloat(Speed, planarSpeed); // drives a 1D blend tree (idle/walk/run)
_anim.SetBool(IsGrounded, grounded); // gates a falling/landing transition
}
public void DoJump() => _anim.SetTrigger(Jump); // fire-and-forget; auto-resets after use
}
2. Smooth a noisy input into a blend parameter
// dampTime smooths Speed so the blend tree doesn't snap; great for analog sticks.
_anim.SetFloat(Speed, targetSpeed, 0.1f /* dampTime */, Time.deltaTime);
3. Play / cross-fade a state directly (bypassing parameter conditions)
// Useful for hit reactions where you want an immediate, explicit transition.
_anim.CrossFade("Hit", 0.1f); // blend over 0.1s normalized
// Or jump instantly: _anim.Play("Hit");
4. Wait until the current state finishes
private System.Collections.IEnumerator AfterAttack()
{
var info = _anim.GetCurrentAnimatorStateInfo(0); // layer 0
yield return new WaitForSeconds(info.length); // approximate clip length
// ...follow-up logic
}
Pitfalls
SetTriggermissed or "sticks" — triggers are consumed by the next satisfied transition and auto-reset; if no transition consumes it, it can fire later unexpectedly. UseResetTriggerto clear, or prefer aBoolwhen the condition is a sustained state.- String parameter typos fail silently — a misspelled name just does nothing. Use
Animator.StringToHashand cache the int hashes. - Transition feels laggy —
Has Exit Timemakes the transition wait for the clip to reach a normalized time. Uncheck it for responsive, condition-driven transitions (jump, hit). - Character slides or won't move —
Apply Root Motionis on but your code also moves the transform (or vice versa). Decide: root motion or scripted movement, not both. - Upper-body layer overrides the whole body — set the layer's Blend mode (Override vs
Additive), assign an Avatar Mask, and tune
layerWeight(0–1). - IK does nothing — IK only applies inside
OnAnimatorIK, requires "IK Pass" enabled on the layer, and needs a Humanoid Avatar.
References
- For blend trees (1D vs 2D Freeform/Directional), animation layers + Avatar Masks,
and humanoid IK (
OnAnimatorIK,SetIKPositionWeight,SetIKPosition, look-at), readreferences/blend-trees-and-ik.md. - Primary docs: Unity Manual "Animation" section and
ScriptReference/Animator.
Related skills
unity-csharp-scripting— the MonoBehaviour and coroutine timing used above.unity-physics— moving the body that the animation visualises.game-ai— deciding when to play which animation state.
Current listing version
1.0.0
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 针对 Unity 动画系统提供专业化支持,解决动画状态机、参数驱动、混合树等核心开发痛点
- 明确区分适用与不适用场景,帮助用户精准选择工具
Highlights
- 触发描述清晰完整,覆盖多种使用变体,边界定义明确
Areas to improve
-
Document is too long Reported severity: Minor
Skill 文档内容超过500行,可能影响阅读体验
Recommendation: 考虑将部分内容拆分为子文档或通过引用方式组织
Highlights
- 文档结构完整,包含工作流程、模式、陷阱等关键章节
- 提供了实用的代码示例和最佳实践
Areas to improve
-
缺少部分异常处理说明 Reported severity: Minor
未覆盖 Animator 组件未赋值等常见运行时异常的处理建议
Recommendation: 补充关键组件空值检查和错误处理的最佳实践
Highlights
- 覆盖了常见陷阱和错误用法,如参数 typo、Exit Time 设置等
- 提供了性能优化建议(如使用 StringToHash 缓存参数)
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- github.com
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.