<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/AnimationLibraryComponent/AnimationCollection/subscript(_:)-4sfyo",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Subscript",
  "symbol" : {
    "kind" : "Instance Subscript",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation25AnimationLibraryComponentV0C10CollectionVyAA0C8ResourceCSgSScip"
  },
  "title" : "subscript(_:)"
}
-->

# subscript(_:)

Accesses a single animation in the collection with a key.

```
subscript(key: String) -> AnimationResource? { get set }
```

## Parameters

`key`

A name for the animation to look up.

## Return Value

An animation resource, or `nil` if the component can’t find one that maps
to the `key`.

---

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)