<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLRenderPassColorAttachmentDescriptorArray/setObject:atIndexedSubscript:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(cs)MTLRenderPassColorAttachmentDescriptorArray(im)setObject:atIndexedSubscript:"
  },
  "title" : "setObject:atIndexedSubscript:"
}
-->

# setObject:atIndexedSubscript:

Sets the descriptor for the specified color attachment.

```
- (void) setObject:(MTLRenderPassColorAttachmentDescriptor *) attachment atIndexedSubscript:(NSUInteger) attachmentIndex;
```

## Parameters

`attachment`

A descriptor that contains color attachment information. Specify `nil` to reset the attachment to its default values.

`attachmentIndex`

An index in the color attachment array.

## Discussion

This method copies the color attachment information from the descriptor into the specified attachment in the array. Because the method copies the information, you can modify and reuse the descriptor without affecting a previously set attachment.

---

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)