---
title: "load(named:in:)"
framework: realitykit
role: symbol
role_heading: Type Method
path: "realitykit/textureresource/load(named:in:)"
---

# load(named:in:)

Returns a texture resource by synchronously loading it from a bundle.

## Declaration

```swift
@MainActor @preconcurrency static func load(named name: String, in bundle: Bundle? = nil) throws -> TextureResource
```

## Parameters

- `name`: The name of the resource. The filename extension is optional.
- `bundle`: The bundle to search for the resource. Use nil to indicate the app’s bundle.

## Return Value

Return Value The loaded resource.

## Discussion

Discussion Loading a TextureResource with this method blocks the main actor because it’s synchronous, so only call it from a command-line application. The method can stall a regular app, which makes it visibly hitch, and the system terminates an app if its UI becomes unresponsive. See init(named:in:) for an example that demonstrates how to safely load content. This method loads the image that the URL specifies, and creates a texture resource from it. The method blocks until it finishes loading the image and creating the texture resource. RealityKit automatically creates a resource name based on the name and bundle values. RealityKit uses the resource name to identify texture resources, and to match texture resources between networked peers. Specify a unique resource name for each texture resource you load or generate.

## See Also

### Loading a texture

- [init(named:in:)](realitykit/textureresource/init(named:in:).md)
- [init(named:in:options:)](realitykit/textureresource/init(named:in:options:).md)
- [init(contentsOf:withName:options:)](realitykit/textureresource/init(contentsof:withname:options:).md)
- [init(contentsOf:withName:)](realitykit/textureresource/init(contentsof:withname:).md)
- [load(named:in:options:)](realitykit/textureresource/load(named:in:options:).md)
- [load(contentsOf:withName:options:)](realitykit/textureresource/load(contentsof:withname:options:).md)
- [load(contentsOf:withName:)](realitykit/textureresource/load(contentsof:withname:).md)
- [loadAsync(named:in:)](realitykit/textureresource/loadasync(named:in:).md)
- [loadAsync(named:in:options:)](realitykit/textureresource/loadasync(named:in:options:).md)
- [loadAsync(contentsOf:withName:)](realitykit/textureresource/loadasync(contentsof:withname:).md)
