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.

1 Like

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

2 Likes

시작하기 | 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

9 Likes

WTFusername, love you bro thank you dearly!

Thanks a lot, this solved my issue too!

adding minor delay with couroutines, resolved my issue

1 Like