<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/AnimationGraphComponent",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation23AnimationGraphComponentV"
  },
  "title" : "AnimationGraphComponent"
}
-->

# AnimationGraphComponent

A component that drives skeletal animation on an entity using an animation graph.

```
struct AnimationGraphComponent
```

## Overview

[`AnimationGraphComponent`](/documentation/RealityKit/AnimationGraphComponent) attaches a compiled [`AnimationGraphResource`](/documentation/RealityKit/AnimationGraphResource) to an entity.
The component evaluates the graph each frame, computes a skeletal pose by blending and
transitioning between animation clips, and applies the resulting pose to the entity’s
[`SkeletalPosesComponent`](/documentation/RealityKit/SkeletalPosesComponent).

Multiple components in the same scene can reference the same resource, which lets a
single graph drive many entities without duplicating its underlying data. Each component
keeps its own per-instance evaluation state — animation timing, state-machine progress,
and parameter values — so characters that share a graph stay independent.

### Attach a graph to an entity

```swift
entity.components.set(AnimationGraphComponent(graph: graphResource))
```

### Inspect the active graph state

The component exposes the graph’s runtime state for debugging and for building tools
that visualize what a character is doing. [`activeNodes`](/documentation/RealityKit/AnimationGraphComponent/activeNodes) returns every node that
contributed to the most recent pose. To work with a single kind of node, iterate
[`activeStateMachineNodes`](/documentation/RealityKit/AnimationGraphComponent/activeStateMachineNodes) or [`activeClipNodes`](/documentation/RealityKit/AnimationGraphComponent/activeClipNodes) instead — those collections return
the narrower [`AnimationGraphComponent.ActiveStateMachineNode`](/documentation/RealityKit/AnimationGraphComponent/ActiveStateMachineNode) and [`AnimationGraphComponent.ActiveClipNode`](/documentation/RealityKit/AnimationGraphComponent/ActiveClipNode) types, which expose only
the fields that apply to that node kind.

```swift
for node in component.activeStateMachineNodes {
    print("\(node.name): state \(node.currentState)")
}

for node in component.activeClipNodes {
    print("\(node.name): cycle \(node.currentCycle)")
}
```

To observe outputs the graph emits back to the rest of the application, read
[`activeTags`](/documentation/RealityKit/AnimationGraphComponent/activeTags). Tags are graph-level signals that the graph raises while certain states
are active.

## Topics

### Creating a component

[`init(graph:)`](/documentation/RealityKit/AnimationGraphComponent/init(graph:))

Creates a component that drives skeletal animation on an entity using the supplied
compiled animation graph.

### Accessing the graph

[`graph`](/documentation/RealityKit/AnimationGraphComponent/graph)

The compiled animation graph that backs this component.

### Accessing active nodes

[`activeNodes`](/documentation/RealityKit/AnimationGraphComponent/activeNodes)

Every node that contributed to the most recent graph evaluation tick.

[`AnimationGraphComponent.ActiveNode`](/documentation/RealityKit/AnimationGraphComponent/ActiveNode)

Common debug information for any node that was active during the most recent
graph evaluation tick.

[`activeClipNodes`](/documentation/RealityKit/AnimationGraphComponent/activeClipNodes)

The animation clip nodes that were active during the most recent graph evaluation
tick.

[`AnimationGraphComponent.ActiveClipNode`](/documentation/RealityKit/AnimationGraphComponent/ActiveClipNode)

Debug information for an active animation clip node within the graph.

[`activeStateMachineNodes`](/documentation/RealityKit/AnimationGraphComponent/activeStateMachineNodes)

The state machine nodes that were active during the most recent graph evaluation
tick.

[`AnimationGraphComponent.ActiveStateMachineNode`](/documentation/RealityKit/AnimationGraphComponent/ActiveStateMachineNode)

Debug information for an active state machine node within the graph.

### Accessing active tags

[`activeTags`](/documentation/RealityKit/AnimationGraphComponent/activeTags)

The tags that were active or fired during the most recent graph evaluation tick.

[`AnimationGraphComponent.ActiveTag`](/documentation/RealityKit/AnimationGraphComponent/ActiveTag)

A graph-level signal raised by the graph while certain states are active.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)