I show a waiting animation, log the user into their account, then hiding the waiting animation element. But it’s not applying the style when the callback is coming from a Task. I am seeing “called” show up in the log though.
I would rather not queue up callbacks and send them during Update() on the FirebaseManager but I think that would work.
I tried MarkDirtyRepaint() but that didn’t work.
What do I need to do to get style to apply in a callback from a Task?
public class FirebaseManager : MonoBehaviour
{
...
public void TestLogin(string email, string password, Action<bool> callback) {
System.Threading.Tasks.Task.Run(() => FakeSignIn()).ContinueWith(task => {
callback(false);
});
}
void FakeSignIn() {
Debug.Log("fake signed in");
}
}
public class LoginPanel : VisualElement
{
...
void OnSubmitClick() {
ShowWaitState();
FirebaseManager.instance.TestLogin(email, password, (x) => HideWaitState());
}
void HideWaitState() {
Debug.Log("called");
this.Q("submit-button").SetEnabled(true);
this.Q("rotate-circle-panel").style.display = DisplayStyle.None;
}
}