Skip to Content

Floating Text

Runtime components: FloatingTextCoordinator, FloatingText, FloatingTextBase
Service entrypoint: GameUI.SpawnFloatingText
Adapter bridge: UnityGameUIAdapter (UnityGameUIAdapter.FloatingText.partial.cs)

This flow lets gameplay code request floating text through the GameUI service, while Unity adapter code resolves coordinator/style/prefab details.

Spawn flow

  1. Gameplay creates an invoke payload and calls GameUI.SpawnFloatingText.
  2. GnosisGameUIService validates parameters and emits FloatingTextRequested.
  3. UnityGameUIAdapter receives the request and forwards to FloatingTextCoordinator.
  4. Coordinator spawns from style binding (pool-backed when configured).
  5. Optional runtime overrides are applied on the spawned instance.

Required and common parameters

  • kind (required): WorldNumber, WorldText, UiNumber, UiText
  • styleId (optional): style binding id in coordinator (default fallback)
  • floatingTextGroup (optional): group id used by group-control behaviors
  • Content:
    • number for *Number
    • text for *Text
  • Position:
    • worldX, worldY, worldZ for world variants
    • uiX, uiY for UI variants
  • uiParentName (optional): adapter-resolved UI parent by name
  • overrides (optional): runtime-safe field overrides

C# invoke example (UI number)

Match3FloatingTextInvoke.Example.cs
using GnosisEngine; using UnityEngine; public static class FloatingTextExamples { public static void SpawnScorePopup(GnosisGameUIService gameUi, GnosisStore store, Vector2 anchored, long amount) { if (gameUi == null || store == null) return; var payload = GnosisNode.CreateObject(store); payload.Set("kind", "UiNumber"); payload.Set("styleId", "default"); payload.Set("floatingTextGroup", "match3-score"); payload.Set("number", Mathf.Max(1f, (float)amount)); payload.Set("uiX", anchored.x); payload.Set("uiY", anchored.y); var overrides = GnosisNode.CreateObject(store); overrides.Set("lifetime", 0.7f); overrides.Set("durationFadeIn", 0.12f); overrides.Set("durationFadeOut", 0.18f); overrides.Set("fadeInEase", "OutBack"); overrides.Set("fadeOutEase", "InCubic"); overrides.Set("motionPreset", "SoftPop"); var lerp = GnosisNode.CreateObject(store); lerp.Set("minY", 0.35f); lerp.Set("maxY", 0.6f); lerp.Set("speed", 5f); overrides.Set("lerp", lerp); payload.Set("overrides", overrides); var result = gameUi.InvokeFunction("SpawnFloatingText", payload); if (!result.Success) Debug.LogWarning($"SpawnFloatingText failed: {result.Error}"); } }

JSON-style invoke example

{ "service": "GameUI", "method": "SpawnFloatingText", "payload": { "kind": "UiText", "styleId": "default", "floatingTextGroup": "toast", "text": "Combo x4", "uiX": 180.0, "uiY": 220.0, "overrides": { "lifetime": 0.9, "prefix": "+", "fadeInOption": "ScaleFade", "fadeOutOption": "OffsetFade", "fadeInEase": "OutCubic", "fadeOutEase": "InCubic", "movementOption": "Lerp", "motionPreset": "SpinPop", "lerp": { "minX": -0.2, "maxX": 0.2, "minY": 0.35, "maxY": 0.65, "speed": 5.0 } } } }

Override rules

Allowed (runtime-safe) examples:

  • Core: content, prefix, suffix, lifetime, unscaledTime, updateDelay
  • Fade: durationFadeIn/Out, fadeInOption, fadeOutOption, fadeInEase, fadeOutEase, fade vectors/frequencies
  • Movement: movementOption, enableShaking, lerp.*, velocity.*, follow.*, shake.*
  • Rotation/Scale: motionPreset, enableOrthographicScaling, defaultOrthographicSize, maxOrthographicSize

Not overrideable per invoke:

  • Render mode and rendering references (renderMode, TMP/mesh/image references, world/UI reference graph)
  • Style prefab bindings (those stay in FloatingTextCoordinator)

Recommendation

  • Treat styleId as the baseline contract per game feature.
  • Use overrides for situational tuning (for example crit hits, combo pops, boss damage).
  • Keep heavy structural setup in styles; keep per-call overrides to behavior/content values.
Last updated on