<!--
{
  "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/MDLAsset",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Model I/O"
    ],
    "preciseIdentifier" : "c:objc(cs)MDLAsset"
  },
  "title" : "MDLAsset"
}
-->

# MDLAsset

An indexed container for 3D objects and associated information, such as transform hierarchies, meshes, cameras, and lights.

```
class MDLAsset
```

## Overview

You create a [`MDLAsset`](/documentation/ModelIO/MDLAsset) object by loading data from a URL, and you can export an asset to any of several file formats. To access the objects contained in an asset, use [Fast Enumeration](https://developer.apple.com/library/archive/documentation/General/Conceptual/DevPedia-CocoaCore/Enumeration.html#//apple_ref/doc/uid/TP40008195-CH17-SW3), the [`object(at:)`](/documentation/ModelIO/MDLAsset/object(at:)) method, or subscripting. Each object in an asset can be the root of a hierarchy of objects. To traverse that hierarchy, use an object’s [`children`](/documentation/ModelIO/MDLObject/children) property.

An asset may contain timed information, such as a series of mesh morphs. In such cases, the asset’s [`frameInterval`](/documentation/ModelIO/MDLAsset/frameInterval) property is nonzero and the [`startTime`](/documentation/ModelIO/MDLAsset/startTime) and [`endTime`](/documentation/ModelIO/MDLAsset/endTime) properties indicate the range of sample times available in the asset data. For objects contained in the asset, you can use methods such as [`localTransform(atTime:)`](/documentation/ModelIO/MDLTransformComponent/localTransform(atTime:)) and [`boundingBox(atTime:)`](/documentation/ModelIO/MDLObject/boundingBox(atTime:)) to access object properties at a specific time sample. Requesting a sample outside the time range clamps to the start or end sample. Some asset formats support continuous sampling with interpolation for times between the samples stored in the asset; other asset formats are discrete. For an asset with discrete time information, requesting a sample time that falls between the samples stored in the asset returns data for the immediately preceding time.

## Topics

### Creating an Asset

[`class func canImportFileExtension(String) -> Bool`](/documentation/ModelIO/MDLAsset/canImportFileExtension(_:))

Returns a Boolean value that indicates whether the [`MDLAsset`](/documentation/ModelIO/MDLAsset) class can read asset data from files with the specified extension.

[`init(url: URL)`](/documentation/ModelIO/MDLAsset/init(url:)-1f4ym)

Initializes an asset from the file at the specified URL.

[`init(bufferAllocator: (any MDLMeshBufferAllocator)?)`](/documentation/ModelIO/MDLAsset/init(bufferAllocator:))

Initializes an empty asset, using the specified buffer allocator.

[`init(url: URL?, vertexDescriptor: MDLVertexDescriptor?, bufferAllocator: (any MDLMeshBufferAllocator)?)`](/documentation/ModelIO/MDLAsset/init(url:vertexDescriptor:bufferAllocator:)-1tchi)

Initializes an asset from the file at the specified URL, using the specified vertex descriptor and buffer allocator.

[`init(url: URL, vertexDescriptor: MDLVertexDescriptor?, bufferAllocator: (any MDLMeshBufferAllocator)?, preserveTopology: Bool, error: NSErrorPointer)`](/documentation/ModelIO/MDLAsset/init(url:vertexDescriptor:bufferAllocator:preserveTopology:error:)-510xi)

Initializes an asset from the file at the specified URL, using the specified options for allocating and transforming data during import.

### Exporting an Asset

[`class func canExportFileExtension(String) -> Bool`](/documentation/ModelIO/MDLAsset/canExportFileExtension(_:))

Returns a Boolean value that indicates whether the [`MDLAsset`](/documentation/ModelIO/MDLAsset) class can write asset data as a file with the specified format extension.

[`- (BOOL) exportAssetToURL:(NSURL *) URL;`](/documentation/ModelIO/MDLAsset/exportAssetToURL:)

Writes asset data to a file at the specified URL.

[`func export(to: URL) throws`](/documentation/ModelIO/MDLAsset/export(to:))

Writes asset data to a file at the specified URL and reports errors that occur during export.

### Working with Asset Content

[`func object(at: Int) -> MDLObject`](/documentation/ModelIO/MDLAsset/object(at:))

Returns the top-level object at the specified index in the asset.

[`subscript(Int) -> MDLObject?`](/documentation/ModelIO/MDLAsset/subscript(_:))

Returns the top-level object at the specified index in the asset, using subscript syntax.

[`var count: Int`](/documentation/ModelIO/MDLAsset/count)

The number of top-level objects in the asset.

[`func childObjects(of: AnyClass) -> [MDLObject]`](/documentation/ModelIO/MDLAsset/childObjects(of:))

Returns all objects contained in the asset of the specified class.

[`func add(MDLObject)`](/documentation/ModelIO/MDLAsset/add(_:))

Adds the specified object to the asset’s list of top-level objects.

[`func remove(MDLObject)`](/documentation/ModelIO/MDLAsset/remove(_:))

Removes the specified object from the asset’s list of top-level objects.

[`var boundingBox: MDLAxisAlignedBoundingBox`](/documentation/ModelIO/MDLAsset/boundingBox)

The minimum region entirely enclosing the asset’s contents.

[`func boundingBox(atTime: TimeInterval) -> MDLAxisAlignedBoundingBox`](/documentation/ModelIO/MDLAsset/boundingBox(atTime:))

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

[`var url: URL?`](/documentation/ModelIO/MDLAsset/url)

The URL from which the asset was loaded, if available.

[`var bufferAllocator: any MDLMeshBufferAllocator`](/documentation/ModelIO/MDLAsset/bufferAllocator)

An object responsible for allocating mesh vertex data loaded from the asset.

[`var vertexDescriptor: MDLVertexDescriptor?`](/documentation/ModelIO/MDLAsset/vertexDescriptor)

The description of the vertex data format to be used for loading mesh data from the asset.

[`var masters: any MDLObjectContainerComponent`](/documentation/ModelIO/MDLAsset/masters)

An array of objects that can be reused in the asset’s object hierarchy through instancing.

### Working with Timed Information

[`var frameInterval: TimeInterval`](/documentation/ModelIO/MDLAsset/frameInterval)

The time interval between data samples in the asset.

[`var startTime: TimeInterval`](/documentation/ModelIO/MDLAsset/startTime)

The timestamp for the first timed data sample in the asset.

[`var endTime: TimeInterval`](/documentation/ModelIO/MDLAsset/endTime)

The timestamp for the last timed data sample in the asset.

### Working with Lights

[`class func placeLightProbes(withDensity: Float, heuristic: MDLProbePlacement, using: any MDLLightProbeIrradianceDataSource) -> [MDLLightProbe]`](/documentation/ModelIO/MDLAsset/placeLightProbes(withDensity:heuristic:using:))

Automatically creates and places light probes for use in illuminating a scene.

[`enum MDLProbePlacement`](/documentation/ModelIO/MDLProbePlacement)

Options affecting automatic placement of light probes in a scene, used with the [`placeLightProbes(withDensity:heuristic:using:)`](/documentation/ModelIO/MDLAsset/placeLightProbes(withDensity:heuristic:using:)) method.

### Constants

[Asset File Types](/documentation/ModelIO/asset-file-types)

Uniform Type Identifiers for file formats supported by the Model I/O framework.

### Initializers

[`init(URL: URL)`](/documentation/ModelIO/MDLAsset/init(URL:)-21tmw)

[`init(URL: URL?, vertexDescriptor: MDLVertexDescriptor?, bufferAllocator: (any MDLMeshBufferAllocator)?)`](/documentation/ModelIO/MDLAsset/init(URL:vertexDescriptor:bufferAllocator:)-4rokm)

[`init(URL: URL, vertexDescriptor: MDLVertexDescriptor?, bufferAllocator: (any MDLMeshBufferAllocator)?, preserveTopology: Bool, error: NSErrorPointer)`](/documentation/ModelIO/MDLAsset/init(URL:vertexDescriptor:bufferAllocator:preserveTopology:error:)-7bivy)

### Instance Properties

[`var animations: any MDLObjectContainerComponent`](/documentation/ModelIO/MDLAsset/animations)

[`var originals: any MDLObjectContainerComponent`](/documentation/ModelIO/MDLAsset/originals)

[`var resolver: (any MDLAssetResolver)?`](/documentation/ModelIO/MDLAsset/resolver)

[`var upAxis: vector_float3`](/documentation/ModelIO/MDLAsset/upAxis)

### Instance Methods

[`func loadTextures()`](/documentation/ModelIO/MDLAsset/loadTextures())

[`func object(atPath: String) -> MDLObject`](/documentation/ModelIO/MDLAsset/object(atPath:))

## Relationships

### Conforms To

[`NSFastEnumeration`](/documentation/Foundation/NSFastEnumeration)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)