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
- Gameplay creates an invoke payload and calls
GameUI.SpawnFloatingText. GnosisGameUIServicevalidates parameters and emitsFloatingTextRequested.UnityGameUIAdapterreceives the request and forwards toFloatingTextCoordinator.- Coordinator spawns from style binding (pool-backed when configured).
- Optional runtime
overridesare applied on the spawned instance.
Required and common parameters
kind(required):WorldNumber,WorldText,UiNumber,UiTextstyleId(optional): style binding id in coordinator (defaultfallback)floatingTextGroup(optional): group id used by group-control behaviors- Content:
numberfor*Numbertextfor*Text
- Position:
worldX,worldY,worldZfor world variantsuiX,uiYfor UI variants
uiParentName(optional): adapter-resolved UI parent by nameoverrides(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
styleIdas the baseline contract per game feature. - Use
overridesfor 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