Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

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

Discussion in 'UGUI & TextMesh Pro' started by unity_66BEB2AFC29BC48451E6, Dec 8, 2022.

  1. unity_66BEB2AFC29BC48451E6

    unity_66BEB2AFC29BC48451E6

    Joined:
    Jan 11, 2022
    Posts:
    3
    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.
     
  2. unity_66BEB2AFC29BC48451E6

    unity_66BEB2AFC29BC48451E6

    Joined:
    Jan 11, 2022
    Posts:
    3
    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
     
  3. halefbudanur

    halefbudanur

    Joined:
    Jul 29, 2022
    Posts:
    2
    Did you find a solution?
     
  4. unity_66BEB2AFC29BC48451E6

    unity_66BEB2AFC29BC48451E6

    Joined:
    Jan 11, 2022
    Posts:
    3
    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.
     
  5. halefbudanur

    halefbudanur

    Joined:
    Jul 29, 2022
    Posts:
    2
    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?
     
  6. Gilvius-gls

    Gilvius-gls

    Joined:
    Jan 7, 2019
    Posts:
    2
    I solved this problem by making a delay of 0.2 seconds after closing the ad and after that I show the reward panel