Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

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
     
  7. WTFusername

    WTFusername

    Joined:
    Aug 13, 2018
    Posts:
    5
    시작하기 | 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
     
    Last edited: Jun 16, 2023
    vonSchlank, y01cu, Minato243 and 6 others like this.
  8. St6rmfury

    St6rmfury

    Joined:
    Apr 11, 2023
    Posts:
    1
    WTFusername, love you bro thank you dearly!
     
  9. y01cu

    y01cu

    Joined:
    Oct 10, 2021
    Posts:
    9

    Thanks a lot, this solved my issue too!
     
  10. Devs007

    Devs007

    Joined:
    Sep 28, 2022
    Posts:
    5
    adding minor delay with couroutines, resolved my issue