This document outlines the planned capabilities and MCP tools for Phase 3:
- Advanced animation (blend trees, layered state machines, timelines)
- VFX / particles
- Advanced physics setups (joints, ragdolls)
The emphasis is on:
- Clear separation between high-level JSON contracts and Unity YAML/asset details.
- Backward-compatible evolution from Phase 2 basic animation.
- Multi-layer Animator Controllers.
- Blend trees for movement (idle/walk/run).
- Sub-state machines for locomotion, combat, etc.
- Timeline sequences for cutscenes / scripted events.
Contracts live under UnityMcp.Core.Contracts.AnimationContracts and build on
the Phase 2 basic animator schema:
AnimatorLayerContractAnimatorStateMachineContractAnimatorBlendTreeContractTimelineTrackContractTimelineClipContract
These contracts are Unity-agnostic JSON surrogates: they are structured to map cleanly to Unity Animator Controllers and Timelines in the future, but in Phase 3 the server writes .json assets plus .meta files, not native .controller or Timeline assets.
Example (simplified):
{
"name": "CharacterAnimatorAdvanced",
"layers": [
{
"name": "Base Layer",
"defaultState": "Locomotion",
"states": [ /* as in basic animator */ ],
"subStateMachines": [
{
"name": "Locomotion",
"defaultState": "Idle",
"states": [ /* Idle, Walk, Run */ ],
"transitions": [ /* intra-locomotion transitions */ ]
}
]
}
]
}Timelines:
{
"name": "IntroCutscene",
"tracks": [
{
"type": "Animation",
"binding": "Player",
"clips": [
{ "name": "IntroPose", "clip": "Assets/Animations/IntroPose.anim", "start": 0.0, "duration": 2.0 }
]
},
{
"type": "Audio",
"binding": "MusicSource",
"clips": [
{ "name": "IntroMusic", "audio": "Assets/Audio/Intro.ogg", "start": 0.0, "duration": 30.0 }
]
}
]
}-
unity_create_advanced_animator- Parameters:
projectPath,fileName(e.g.Assets/Animations/CharacterAdvanced.animator.json),animatorJson. - Implementation:
IUnityService.CreateAdvancedAnimatorAsyncinFileUnityServicevalidates the JSON against the advanced schema (layers with valid defaultState) and writes a JSON surrogate asset plus.meta. - Result JSON:
{ success, path, message, errors[] }, with validation failures using codes such asAdvancedAnimator.InvalidJsonandAdvancedAnimator.InvalidLayer.
- Parameters:
-
unity_create_timeline- Parameters:
projectPath,fileName(e.g.Assets/Timelines/IntroCutscene.timeline.json),timelineJson. - Implementation:
IUnityService.CreateTimelineAsyncdeserializes toTimelineDefinition, validates referenced animation/audio clip paths and writes a JSON surrogate asset plus.meta. - Result JSON:
{ success, path, message, errors[], warnings[] }, with parse failures usingTimeline.InvalidJsonand missing assets reported asTimeline.MissingClip/Timeline.MissingAudiowarnings.
- Parameters:
- Generate common effects:
- Muzzle flashes
- Explosions
- Weather (rain, snow)
- Magic/energy effects
- Target built-in Particle System first; VFX Graph may be added later.
Contracts under UnityMcp.Core.Contracts.VfxContracts:
ParticleEffectContractParticleEmissionContractParticleShapeContractParticleColorOverLifetimeContract
Example:
{
"name": "ExplosionSmall",
"duration": 1.0,
"looping": false,
"startLifetime": 0.5,
"startSpeed": 5.0,
"startSize": 1.0,
"startColor": { "r": 1, "g": 0.6, "b": 0.1, "a": 1 },
"emission": {
"rateOverTime": 0,
"bursts": [
{ "time": 0.0, "count": 50 }
]
},
"shape": {
"type": "Sphere",
"radius": 0.5
}
}unity_create_vfx_asset- Parameters:
projectPathfileName(e.g.Assets/VFX/ExplosionSmall.vfx.json)vfxJson(JSON matchingParticleEffectContract)
- Implementation:
IUnityService.CreateVfxAssetAsyncinFileUnityServicedeserializesvfxJsonintoParticleEffectContract, performs basic semantic checks (non‑negative duration, valid burst counts, etc.), and writes a JSON surrogate asset plus.meta.
- Result JSON:
- Uses the
ImportValidationResultpattern fromToolContracts:success: true | falsepath: project‑relative path to the generated.vfx.jsonasset (when created).message: high‑level outcome summary.errors: array ofUnityMcpError.
- Typical error codes:
Vfx.InvalidJson(category:Validation) when the payload cannot be parsed.Vfx.InvalidParameters(category:Validation) for semantic issues such as negative durations or invalid emission settings.
- Uses the
- Parameters:
- Pre-configured ragdoll setups for humanoid characters.
- Joint and constraint rigs for vehicles, doors, and mechanical objects.
Contracts under UnityMcp.Core.Contracts.PhysicsContracts:
RagdollBoneContractRagdollSetupContractJointContract
Example:
{
"name": "HumanoidRagdoll",
"bones": [
{ "name": "Hips", "colliderType": "Capsule", "mass": 10.0 },
{ "name": "Spine", "colliderType": "Box", "mass": 8.0 }
]
}unity_create_physics_setup- Parameters:
projectPathfileName(e.g.Assets/Physics/HumanoidRagdoll.physics.json)physicsJson(JSON matchingRagdollSetupContract)
- Implementation:
IUnityService.CreatePhysicsSetupAsyncinFileUnityServicedeserializesphysicsJsonintoRagdollSetupContract, validates that bones and joints reference valid names, and writes a JSON surrogate asset plus.meta.
- Result JSON:
- Follows the same
ImportValidationResult‑style shape used by other Phase 3 tools:success: true | falsepath: project‑relative path to the generated.physics.jsonasset (when created).message: high‑level outcome summary.errors: array ofUnityMcpError.
- Typical error codes:
PhysicsSetup.InvalidJson(category:Validation) when the payload cannot be parsed.PhysicsSetup.InvalidReference(category:Validation) when joints or bones reference non‑existent names.
- Follows the same
- Parameters:
- All advanced systems rely on:
- The shared
UnityMcpErrorCategory/UnityMcpErrortaxonomy. ImportValidationResult‑style envelopes for multi‑error responses (advanced animator, VFX, physics, timelines where applicable).
- The shared
- Tools must:
- Preserve additive contracts so that existing clients depending on Phase 2 navigation/input/animation continue to work.
- Keep JSON schemas stable so future Unity‑native asset generation can reuse the same contracts and MCP tool names.
This document now reflects the implemented Phase 3 behavior: JSON‑level contracts, surrogate asset generation under Assets/…/*.json, and consistent result shapes and error codes for advanced animation, VFX, and physics tools.
When Unity Editor or batch tooling is available, the existing JSON contracts can be mapped to real Unity assets. The following is a design reference for implementers; no Unity DLLs or runtime dependency are required in this repo.
-
Advanced animator
- Contracts:
AnimatorLayerContract,AnimatorStateMachineContract, states, transitions, blend trees. - Unity target: Animator Controller asset (
.controller). YAML includesAnimatorStateMachine,AnimatorState,AnimatorStateTransition, and (for blend trees)BlendTreewith motion references. Layers map to top-level state machines; sub-state machines map to nestedChildStateMachineentries. Default state and transitions map todefaultState/transitionsin the state machine serialization.
- Contracts:
-
Timeline
- Contracts:
TimelineDefinition,TimelineTrackContract,TimelineClipContract(animation clip path, audio path, start, duration). - Unity target: Timeline Playable Asset (e.g.
.playableor Timeline-specific asset). YAML includesPlayableAsset, track bindings (binding to a GameObject or component), and clips withstart,duration, and references to animation clips or audio assets. Animation tracks map toAnimationPlayableAsset; audio tracks toAudioPlayableAsset.
- Contracts:
-
VFX
- Contracts:
ParticleEffectContract,ParticleEmissionContract,ParticleShapeContract, color and burst settings. - Unity target: Built-in Particle System (component on a GameObject, or prefab). Serialization is component-based (ParticleSystem module data). Alternatively, VFX Graph can be targeted later with a separate mapping from the same contract to VFX Graph asset structure.
- Contracts:
-
Physics
- Contracts:
RagdollSetupContract,RagdollBoneContract,JointContract(bone names, collider types, mass, joint type and connected body). - Unity target: Prefab with hierarchy of GameObjects; each bone has a Rigidbody and Collider (Capsule/Box/Sphere from
colliderType). Joints (Hinge, ConfigurableJoint, etc.) connect parent and child bones. Anchor and axis can be derived from bone names or default conventions.
- Contracts:
MCP tool names and JSON request/response shapes remain unchanged; a future “Unity-native” writer (e.g. an Editor script or separate service that reads the same JSON and writes the above assets) can be plugged in or replace the current JSON-surrogate implementation when running inside or alongside Unity.
- Golden fixtures: Implemented; advanced systems fixtures live under
UnityMcp.Tests/Fixtures/AdvancedSystems/(see validation-pipeline-and-tests.md §4.3). - Extended recipe options: Implemented;
unity_create_prototype_recipesupportsincludeMainMenuand optionalpackagesJson. Template-based scene variants remain doc-only.