mirror of
https://github.com/Donchitos/Claude-Code-Game-Studios
synced 2026-04-30 17:37:19 +00:00
48 coordinated Claude Code subagents for indie game development: - 3 leadership agents (creative-director, technical-director, producer) - 10 department leads (game-designer, lead-programmer, art-director, etc.) - 23 specialist agents (gameplay, engine, AI, networking, UI, tools, etc.) - 12 engine-specific agents (Godot, Unity, Unreal with sub-specialists) Infrastructure: - 34 skills (slash commands) for workflows, reviews, and team orchestration - 8 hooks for commit validation, asset checks, session management - 11 path-scoped rules enforcing domain-specific standards - 28 templates for design docs, reports, and collaborative protocols Key features: - User-driven collaboration protocol (Question → Options → Decision → Draft → Approval) - Engine version awareness with knowledge-gap detection (Godot 4.6 pinned) - Phase gate system for development milestone validation - CLAUDE.md kept under 80 lines with extracted doc imports Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
289 lines
6.3 KiB
Markdown
289 lines
6.3 KiB
Markdown
# Unity 6.3 — Animation Module Reference
|
|
|
|
**Last verified:** 2026-02-13
|
|
**Knowledge Gap:** Unity 6 animation improvements, Timeline enhancements
|
|
|
|
---
|
|
|
|
## Overview
|
|
|
|
Unity 6.3 animation systems:
|
|
- **Animator Controller (Mecanim)**: State machine-based (RECOMMENDED)
|
|
- **Timeline**: Cinematic sequences, cutscenes
|
|
- **Animation Rigging**: Procedural runtime animation
|
|
- **Legacy Animation**: Deprecated, avoid
|
|
|
|
---
|
|
|
|
## Key Changes from 2022 LTS
|
|
|
|
### Animation Rigging Package (Production-Ready in Unity 6)
|
|
|
|
```csharp
|
|
// Install: Package Manager > Animation Rigging
|
|
// Runtime IK, aim constraints, procedural animation
|
|
```
|
|
|
|
### Timeline Improvements
|
|
- Better performance
|
|
- More track types
|
|
- Improved signal system
|
|
|
|
---
|
|
|
|
## Animator Controller (Mecanim)
|
|
|
|
### Basic Setup
|
|
|
|
```csharp
|
|
// Create: Assets > Create > Animator Controller
|
|
// Add to GameObject: Add Component > Animator
|
|
// Assign Controller: Animator > Controller = YourAnimatorController
|
|
```
|
|
|
|
### State Transitions
|
|
|
|
```csharp
|
|
Animator animator = GetComponent<Animator>();
|
|
|
|
// ✅ Trigger transition
|
|
animator.SetTrigger("Jump");
|
|
|
|
// ✅ Bool parameter
|
|
animator.SetBool("IsRunning", true);
|
|
|
|
// ✅ Float parameter (blend trees)
|
|
animator.SetFloat("Speed", currentSpeed);
|
|
|
|
// ✅ Integer parameter
|
|
animator.SetInteger("WeaponType", 2);
|
|
```
|
|
|
|
### Animation Layers
|
|
- **Base Layer**: Default animations (locomotion)
|
|
- **Override Layers**: Replace base layer (e.g., weapon swap)
|
|
- **Additive Layers**: Add on top of base (e.g., breathing, aim offset)
|
|
|
|
```csharp
|
|
// Set layer weight (0-1)
|
|
animator.SetLayerWeight(1, 0.5f); // 50% blend
|
|
```
|
|
|
|
---
|
|
|
|
## Blend Trees
|
|
|
|
### 1D Blend Tree (Speed blending)
|
|
|
|
```csharp
|
|
// Idle (Speed = 0) → Walk (Speed = 0.5) → Run (Speed = 1.0)
|
|
animator.SetFloat("Speed", moveSpeed);
|
|
```
|
|
|
|
### 2D Blend Tree (Directional movement)
|
|
|
|
```csharp
|
|
// X-axis: Strafe (-1 to 1)
|
|
// Y-axis: Forward/Back (-1 to 1)
|
|
animator.SetFloat("MoveX", input.x);
|
|
animator.SetFloat("MoveY", input.y);
|
|
```
|
|
|
|
---
|
|
|
|
## Animation Events
|
|
|
|
### Trigger Events from Animation Clips
|
|
|
|
```csharp
|
|
// Add in Animation window: Right-click timeline > Add Animation Event
|
|
// Must have matching method on GameObject:
|
|
|
|
public void OnFootstep() {
|
|
// Play footstep sound
|
|
AudioSource.PlayClipAtPoint(footstepClip, transform.position);
|
|
}
|
|
|
|
public void OnAttackHit() {
|
|
// Deal damage
|
|
DealDamageInFrontOfPlayer();
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Root Motion
|
|
|
|
### Character Movement via Animation
|
|
|
|
```csharp
|
|
Animator animator = GetComponent<Animator>();
|
|
animator.applyRootMotion = true; // Move character based on animation
|
|
|
|
void OnAnimatorMove() {
|
|
// Custom root motion handling
|
|
transform.position += animator.deltaPosition;
|
|
transform.rotation *= animator.deltaRotation;
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Animation Rigging (Unity 6+)
|
|
|
|
### IK (Inverse Kinematics)
|
|
|
|
```csharp
|
|
// Install: Package Manager > Animation Rigging
|
|
// Add: Rig Builder component + Rig GameObject
|
|
|
|
// Two Bone IK (Arm/Leg)
|
|
// - Add Two Bone IK Constraint
|
|
// - Assign Tip (hand/foot), Mid (elbow/knee), Root (shoulder/hip)
|
|
// - Set Target (where hand/foot should reach)
|
|
|
|
// Runtime control:
|
|
TwoBoneIKConstraint ikConstraint = rig.GetComponentInChildren<TwoBoneIKConstraint>();
|
|
ikConstraint.data.target = targetTransform;
|
|
ikConstraint.weight = 1f; // 0-1 blend
|
|
```
|
|
|
|
### Aim Constraint (Look At)
|
|
|
|
```csharp
|
|
// Character looks at target
|
|
MultiAimConstraint aimConstraint = rig.GetComponentInChildren<MultiAimConstraint>();
|
|
aimConstraint.data.sourceObjects[0] = new WeightedTransform(targetTransform, 1f);
|
|
```
|
|
|
|
---
|
|
|
|
## Timeline (Cutscenes)
|
|
|
|
### Basic Timeline Setup
|
|
|
|
```csharp
|
|
// Create: Assets > Create > Timeline
|
|
// Add to GameObject: Add Component > Playable Director
|
|
// Assign Timeline: Playable Director > Playable = YourTimeline
|
|
|
|
// Play from script:
|
|
PlayableDirector director = GetComponent<PlayableDirector>();
|
|
director.Play();
|
|
```
|
|
|
|
### Timeline Tracks
|
|
- **Activation Track**: Enable/disable GameObjects
|
|
- **Animation Track**: Play animations on Animator
|
|
- **Audio Track**: Synchronized audio playback
|
|
- **Cinemachine Track**: Camera movement
|
|
- **Signal Track**: Trigger events at specific times
|
|
|
|
### Signal System (Events)
|
|
|
|
```csharp
|
|
// Create Signal Asset: Assets > Create > Signals > Signal
|
|
// Add Signal Emitter to Timeline track
|
|
// Add Signal Receiver component to GameObject
|
|
|
|
public class CutsceneEvents : MonoBehaviour {
|
|
public void OnDialogueStart() {
|
|
// Triggered by signal
|
|
}
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Animation Playback Control
|
|
|
|
### Play Animation Directly (No State Machine)
|
|
|
|
```csharp
|
|
// ✅ CrossFade (smooth transition)
|
|
animator.CrossFade("Attack", 0.2f); // 0.2s transition
|
|
|
|
// ✅ Play (instant)
|
|
animator.Play("Idle");
|
|
|
|
// ❌ Avoid: Legacy Animation component
|
|
Animation anim = GetComponent<Animation>(); // DEPRECATED
|
|
```
|
|
|
|
---
|
|
|
|
## Animation Curves
|
|
|
|
### Custom Property Animation
|
|
|
|
```csharp
|
|
// In Animation window: Add Property > Custom Component > Your Script > Your Float
|
|
|
|
public class WeaponTrail : MonoBehaviour {
|
|
public float trailIntensity; // Animated by clip
|
|
|
|
void Update() {
|
|
// Intensity controlled by animation curve
|
|
trailRenderer.startWidth = trailIntensity;
|
|
}
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Performance Optimization
|
|
|
|
### Culling
|
|
- `Animator > Culling Mode`:
|
|
- **Always Animate**: Always update (expensive)
|
|
- **Cull Update Transforms**: Stop updating bones when off-screen (RECOMMENDED)
|
|
- **Cull Completely**: Stop all animation when off-screen
|
|
|
|
### LOD (Level of Detail)
|
|
- Simpler animations for distant characters
|
|
- Reduce skeleton bone count for LOD meshes
|
|
|
|
---
|
|
|
|
## Common Patterns
|
|
|
|
### Check if Animation Finished
|
|
|
|
```csharp
|
|
AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0);
|
|
if (stateInfo.IsName("Attack") && stateInfo.normalizedTime >= 1.0f) {
|
|
// Attack animation finished
|
|
}
|
|
```
|
|
|
|
### Override Animation Speed
|
|
|
|
```csharp
|
|
animator.speed = 1.5f; // 150% speed
|
|
```
|
|
|
|
### Get Current Animation Name
|
|
|
|
```csharp
|
|
AnimatorClipInfo[] clipInfo = animator.GetCurrentAnimatorClipInfo(0);
|
|
string currentClip = clipInfo[0].clip.name;
|
|
```
|
|
|
|
---
|
|
|
|
## Debugging
|
|
|
|
### Animator Window
|
|
- `Window > Animation > Animator`
|
|
- Visualize state machine, see active state
|
|
|
|
### Animation Window
|
|
- `Window > Animation > Animation`
|
|
- Edit animation clips, add events
|
|
|
|
---
|
|
|
|
## Sources
|
|
- https://docs.unity3d.com/6000.0/Documentation/Manual/AnimationOverview.html
|
|
- https://docs.unity3d.com/Packages/com.unity.animation.rigging@1.3/manual/index.html
|
|
- https://docs.unity3d.com/Packages/com.unity.timeline@1.8/manual/index.html
|