Pardon our dust! Docs for Yarn Spinner for Unity 3.2 and Yarn Spinner for Godot C# are on docs.yarnspinner.dev (the old docs site). Docs for Yarn Spinner for Unity 3.3 (pre-release, out ASAP), Yarn Spinner for Godot GDScript and Yarn Spinner for Unreal Engine (work in progress) are on /docs/ (the new docs site).

YarnCancellationToken

Token for signalling cancellation to async presenters.
class_name YarnCancellationToken
extends RefCounted

Inherits from RefCounted

#Nested Types

#Properties

#cancellation_mode

var cancellation_mode: int

Type int

#is_cancelled

var is_cancelled: bool

Type bool

#is_hurry_up_requested

var is_hurry_up_requested: bool = false

Type bool

#is_next_content_requested

var is_next_content_requested: bool = false

Type bool

#Signals

#cancellation_requested

signal cancellation_requested(mode: int)

Parameters

  • modeint

#hurry_up_requested

signal hurry_up_requested()

#next_content_requested

signal next_content_requested()

#Methods

#escalate_to_next_content()

func escalate_to_next_content() -> void

#request_hurry_up()

func request_hurry_up() -> void

#request_next_content()

func request_next_content() -> void

#should_hurry()

func should_hurry() -> bool

Returns bool

#should_skip()

func should_skip() -> bool

Returns bool

#wait_for_any_cancellation()

func wait_for_any_cancellation() -> int

Returns int

#wait_for_cancellation(float)

Returns the cancellation mode, or NONE if timed out. Tokens are single-use.
func wait_for_cancellation(timeout: float = 0.0) -> int

Parameters

  • timeoutfloat

Returns int

#wait_for_next_content()

Resumes when next content is requested, or immediately if it already has been. This is the core of the coroutine-style presenter contract:
func run_line(line: YarnLine, token: YarnCancellationToken = null):
    label.text = line.text
    await token.wait_for_next_content()
    label.text = ""
Once this resumes, you are promising to finish promptly and return: the runner holds the line open until every presenter's run_line has actually returned. Nothing enforces the promise, so a presenter that keeps running holds up the whole dialogue.
func wait_for_next_content() -> void

Generated from Yarn Spinner for Godot GDScript 3.3.