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).

YarnNumber

Yarn numbers are 32-bit floats. Godot floats are 64-bit doubles, so every number needs to be snapped to float32 width and displayed with float32 shortest-round-trip formatting to match the other runtimes.
class_name YarnNumber
extends RefCounted

Inherits from RefCounted

#Methods

#round_half_to_even(float)

static func round_half_to_even(v: float) -> float

Parameters

  • vfloat

Returns float

#to_display_string(float)

Formats a number for dialogue display: the shortest decimal that round-trips back to the same float32 value, in plain decimal notation for magnitudes in [0.0001, 1e9), scientific otherwise.
static func to_display_string(v: float) -> String

Parameters

  • vfloat

Returns String

#to_f32(float)

Rounds a double to the nearest representable 32-bit float value.
static func to_f32(v: float) -> float

Parameters

  • vfloat

Returns float

#to_int32(float)

static func to_int32(v: float) -> int

Parameters

  • vfloat

Returns int

Generated from Yarn Spinner for Godot GDScript 3.3.