Spent a while tonight stuck before I figured out STM seemingly only updates text with game tab is visible. Would highly recommend also updating when just the scene view is visible.
Text for Unity, Super-Powered! · By
Hey Chris,
I'm unable to reproduce your issue in both Unity 5.3.4 and Unity 2019.2. What version of Unity are you using? When you say "updates text", do you mean... "text reading out" or "text doing an animation, like waves or jitters"? For me, text seems to behave as expected when just the scene view is open, even when I fully close the game view.
After investigating a bit more, the issue turned out to be related to the Project Settings / Player / Run in Background setting.
Not sure if this a new change (I'm on 2020.1.12f1), but clicking on the inspector now deselects the game view and marks play mode as running in background which in turn stops Super Text Mesh from updating. Specifcally GetDeltaTime2 returns 0f in this state which blocks the running ReadOutText coroutine. Since the rest of game mode still runs in this situation I think the expected behaviour is probably to always return the engine reported delta time regardless of whether the app is backgrounded.
Ah, now I see!
If Run In Background is disabled in newer versions of Unity, while things like physics still run if only scene view is open, text freezes. In-editor, the application is only "focused" if the game view has focus. I was worried about this breaking behaviour, but it looks like tabbing out of the editor window and back in seems to work as expected anyway? Well, mostly-expected... text still skips forward a bit when the application resumes. I'll push this for the next update.
If you want to have the behaviour change now, all I did was change OnApplicationFocus() to this:
void OnApplicationFocus(bool focused) { #if !UNITY_EDITOR if(!Application.runInBackground) { applicationFocused = focused; } #endif }