had this annoying flicker in a dotween-based ui manager where text would pop in fully opaque for a single frame before fading in. the culprit was a fastswapduration feature that tried to speed up transitions when swapping between text elements quickly. it was setting a tween duration based on whether the previous element was still fading, which created this race condition where the new text would flash at full alpha before the fade could kick in. real ugly, looked broken.
the fix was stripping all that fastswapduration logic entirely. no more conditional durations, no more guessing at timing. every showtext call now starts by forcing alpha to zero on the canvasgroup, killing any active tween on that element so nothing overlaps, and then doing a clean dotween fade-in with a fixed duration. no more flicker because the canvasgroup is guaranteed invisible before any fade begins. it's simpler, more predictable, and removes an entire class of race-condition bugs.
integrating with the trigger script was straightforward since the ui manager already uses a singleton pattern. any collision trigger or interaction script can just call uimanager.instance.showtext() with the string and duration. the singleton ensures only one instance manages the ui canvas, so triggers don't step on each other. combined with the stripped-down fade logic, each showtext call is self-contained — kill previous tween, set alpha to zero, tween to one. clean, no flicker, no weird state.
the whole thing reinforces that trying to optimize for perceived speed with conditional timing often backfires. starting from a known state every time and letting dotween handle the interpolation smoothly gives a better result than any clever fast-path optimization ever did.