Back to API Reference
Class
DocumentSource
abstract
Where a text component's document comes from. A source yields a Rope built for the scan profile of the text that renders it; the built-in sources read files, streaming assets and text assets, and a custom subclass appears in the inspector picker like any other. Every setting is state: a change publishes through the source, and a loader holding it reloads.
Derived Types(2)
Types that inherit from DocumentSource.
CC
FileDocumentSource
A file addressed as a root folder plus a relative path. Roots the platform exposes as folders load synchronously through [[FileTextSource]]; roots that are URLs (streaming assets on Android and on the web) download and deliver later, which needs the built-in Unity Web Request module — without it a URL location fails to load.
TextAssetDocumentSource
A [[TextAsset]]'s bytes as the document. Unity holds the whole asset in memory, so this suits documents up to a few megabytes; larger files belong in streaming assets behind a [[FileDocumentSource]].
public abstract IDisposable Load()Starts loading. onLoaded runs on the main thread with the document — before this call returns when the source is synchronous. A source that cannot load throws (synchronous) or lets the exception surface from its completion (asynchronous); the callback never sees a failed load. Returns a handle whose disposal cancels a pending asynchronous load, or.
