<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ModelIO",
  "identifier" : "/documentation/ModelIO/MDLObject",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Model I/O"
    ],
    "preciseIdentifier" : "c:objc(cs)MDLObject"
  },
  "title" : "MDLObject"
}
-->

# MDLObject

The base class for objects that are part of a 3D asset, including meshes, cameras, and lights.

```
class MDLObject
```

## Overview

When you load content from an asset file using the [`MDLAsset`](/documentation/ModelIO/MDLAsset) class, Model I/O creates instances of the [`MDLObject`](/documentation/ModelIO/MDLObject) subclasses [`MDLMesh`](/documentation/ModelIO/MDLMesh), [`MDLCamera`](/documentation/ModelIO/MDLCamera), and [`MDLLight`](/documentation/ModelIO/MDLLight). For asset formats that describe a collection of meshes, cameras, and lights organized in a hierarchy of spatial transforms, Model I/O also creates instances of the [`MDLObject`](/documentation/ModelIO/MDLObject) class itself to describe the transform nodes that organize the asset’s visual content. Similarly, you use the [`MDLObject`](/documentation/ModelIO/MDLObject) class and its subclasses when creating an object graph to be exported as an asset file using  the [`MDLAsset`](/documentation/ModelIO/MDLAsset) class.

### Extending Model I/O with Components

Model I/O allows you to customize the content and relationships in an object graph with *components*. For each aspect of an object’s functionality, you use a component protocol (extending the [`MDLComponent`](/documentation/ModelIO/MDLComponent) protocol) to define functionality and a class adopting that protocol to implement it. Then, you can use the [`componentConforming(to:)`](/documentation/ModelIO/MDLObject/componentConforming(to:)) and [`setComponent(_:for:)`](/documentation/ModelIO/MDLObject/setComponent(_:for:)) methods to associate those objects with any instance of the [`MDLObject`](/documentation/ModelIO/MDLObject) class or of one of its subclasses. For example, you might define a protocol to add gameplay-related information such as scripting triggers to certain meshes, lights, or cameras in a scene.

Model I/O itself uses this mechanism to handle object hierarchies and spatial transforms: The methods listed in [`Working with Object Hierarchies`](/documentation/ModelIO/MDLObject#Working-with-Object-Hierarchies) use the [`MDLObjectContainerComponent`](/documentation/ModelIO/MDLObjectContainerComponent) protocol to model hierarchic relationships between objects in an asset, and the methods listed in [`Working with Objects in Space`](/documentation/ModelIO/MDLObject#Working-with-Objects-in-Space) use the [`MDLTransformComponent`](/documentation/ModelIO/MDLTransformComponent) protocol to model coordinate space relationships. To add support for an asset file format or object graph that uses other ways to store or compute these relationships, you can use your own classes that adopt these protocols.

## Topics

### Customizing Objects with Components

[`componentConforming(to:)`](/documentation/ModelIO/MDLObject/componentConforming(to:))

Returns the object’s component for the specified protocol.

[`setComponent(_:for:)`](/documentation/ModelIO/MDLObject/setComponent(_:for:))

Associates a component with the object for the specified protocol.

### Working with Object Hierarchies

[`parent`](/documentation/ModelIO/MDLObject/parent)

The parent object that contains this object.

[`children`](/documentation/ModelIO/MDLObject/children)

A component that manages this object’s collection of children.

[`addChild(_:)`](/documentation/ModelIO/MDLObject/addChild(_:))

Adds a child object to this object, creating a container for the object’s children if necessary.

[`enumerateChildObjects(of:root:using:stopPointer:)`](/documentation/ModelIO/MDLObject/enumerateChildObjects(of:root:using:stopPointer:))

Executes the specified block using each object in this object’s child hierarchy.

[`path`](/documentation/ModelIO/MDLObject/path)

A path that identifies the object in an asset’s object hierarchy using object names.

[`atPath(_:)`](/documentation/ModelIO/MDLObject/atPath(_:))

Returns the child object at the specified path.

### Working with Objects in Space

[`boundingBox(atTime:)`](/documentation/ModelIO/MDLObject/boundingBox(atTime:))

Returns the minimum region entirely enclosing the object’s contents at the specified time sample.

[`transform`](/documentation/ModelIO/MDLObject/transform)

A component that manages this object’s spatial transform and its changes over time.

### Managing Rendering Intent

[`hidden`](/documentation/ModelIO/MDLObject/hidden)

A Boolean value indicating whether this object should be used in rendering.

[`instance`](/documentation/ModelIO/MDLObject/instance)

The primary object, if applicable, of which this object is an instance.

[`path`](/documentation/ModelIO/MDLObject/path)

A path that identifies the object in an asset’s object hierarchy using object names.

[`components`](/documentation/ModelIO/MDLObject/components)

### Object Instancing

[`atPath(_:)`](/documentation/ModelIO/MDLObject/atPath(_:))

Returns the child object at the specified path.

[`enumerateChildObjects(of:root:using:stopPointer:)`](/documentation/ModelIO/MDLObject/enumerateChildObjects(of:root:using:stopPointer:))

Executes the specified block using each object in this object’s child hierarchy.

[`subscript(_:)`](/documentation/ModelIO/MDLObject/subscript(_:))

[`setObject:forKeyedSubscript:`](/documentation/ModelIO/MDLObject/setObject:forKeyedSubscript:)

### Constants

[`MDLAxisAlignedBoundingBox`](/documentation/ModelIO/MDLAxisAlignedBoundingBox)

The minimal volume containing an object, used by the [`boundingBox(atTime:)`](/documentation/ModelIO/MDLObject/boundingBox(atTime:)) method.



---

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)