<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/MeshResource/generateText(_:extrusionDepth:font:containerFrame:alignment:lineBreakMode:)-3py6y",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation12MeshResourceC0A3KitE12generateText_14extrusionDepth4font14containerFrame9alignment13lineBreakModeACSS_SfSo6UIFontCSo6CGRectVSo15CTTextAlignmentVSo06CTLineoP0VtFZ"
  },
  "title" : "generateText(_:extrusionDepth:font:containerFrame:alignment:lineBreakMode:)"
}
-->

# generateText(_:extrusionDepth:font:containerFrame:alignment:lineBreakMode:)

Generates a 3D mesh for rendering static text.

```
@MainActor @preconcurrency static func generateText(_ string: String, extrusionDepth: Float = 0.25, font: MeshResource.Font = .systemFont(ofSize: defaultTextFontSize), containerFrame: CGRect = CGRect.zero, alignment: CTTextAlignment = .left, lineBreakMode: CTLineBreakMode = .byTruncatingTail) -> MeshResource
```

## Parameters

`string`

The text to render.

`extrusionDepth`

The extent, in meters, of the extruded text in the
z-axis direction.

`font`

The font to use. The font size is in meters. On tvOS the
default is a 16-point system font; on other platforms it’s the
standard system font size.

`containerFrame`

The size, in meters, of the text frame in the local
coordinate system where the text is laid out. The text frame has the
same origin as the local coordinate system.

    Use a frame size of     `(0,0)`     to tell the method to create a frame large enough to
    contain the generated text.

`alignment`

How the text should be aligned in the text frame.

`lineBreakMode`

How the text should wrap when reaching a frame
boundary.

## Return Value

The text mesh.

---

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)