Graphics device is null. TMPro.TextMeshProUGUI:Awake()

while Instantiating a prefab that contains TMPro receives an error.
"Graphics device is null.
TMPro.TextMeshProUGUI:Awake()
…etc"
note * this happens only when I try to log in with google and cancel it and on cancel shows the popup that contains TMPro.

Unity and other SDK Versions that I’m using.
Unity -V: 2021.3.14f1
Firebase -V: 10.2.0
Facebook -V: 15.1.0
Google. -V: 1.0.4

Did you find a solution?

Yes found the issue
reason: “this happens to me due to not calling the TMPro on the Main thread”.
Google sign-in was not on the main thread and when I received the callback and try to Instantiate the popup that contains TMPro give that error**.**
sol: try Google or any other third-party sign-in or any server query on the Main thread and never call TMPro rather than the Main thread.

Thank you so much.

Actually, my problem is that I’m in the development phase of a game and I give the user extra rights to continue the game after watching a rewarded ad. But the bounty ad is ending and the game is Graphics device is null. Stopping with error TMPro.TextMeshProUGUI:Awake().

Do you have a solution suggestion for this problem?

I solved this problem by making a delay of 0.2 seconds after closing the ad and after that I show the reward panel

시작하기 | Unity | Google for Developers

I found answer bro

We need
MobileAds.RaiseAdEventsOnUnityMainThread = true;

If you are not using admob,
use coroutine and yield return new WaitForEndOfFrame(); is helping you

WTFusername, love you bro thank you dearly!

Thanks a lot, this solved my issue too!

adding minor delay with couroutines, resolved my issue

Good day

i have been Facing the same issue with admob
even after calling

 MobileAds.RaiseAdEventsOnUnityMainThread = true;
            MobileAds.Initialize(status =>
            {
                if (status == null)
                {
                    _isInitialized = null;
                    return;
                }
                _isInitialized = true;
                OnGoogleAdsInitialized?.Invoke();
            });

when initializing the plugin
and even after waiting for 1 second before firing the unity event that deals with giving the reward

private readonly WaitForSeconds Wait = new WaitForSeconds(1);
        private IEnumerator CompletedAdRoutine(Action OnWaitFinished)
        {
            yield return Wait;
            OnWaitFinished.Invoke();
        }

 public void ShowRewardedAds()
        {
            if(rewardedAd!= null && rewardedAd.CanShowAd())
            {
                rewardedAd.Show(_ =>
                {
                    StartCoroutine(CompletedAdRoutine(OnRewardRecived.Invoke));
                });
            }
            else
            {
                LoadAd();
            }
        }

any advice would mean alot to me