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.

public bool IsEmpty{ get }

True when the source names nothing to load — an unset path or asset. A loader loads nothing from an empty source; Load on one throws.

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.