Search Unity

TextMesh Pro breaks when the new Unity Play Asset Delivery feature used.

Discussion in 'UGUI & TextMesh Pro' started by domonyiv, Sep 22, 2021.

  1. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    76
    Hi @Stephan_B,

    Unity recently added support for the Play Asset Delivery (https://docs.unity3d.com/Manual/play-asset-delivery.html) if I start to use it, TextMesh Pro breaks with the following errors.

    Code (CSharp):
    1.  E Unity   : NullReferenceException: Object reference not set to an instance of an object.
    2.  E Unity   :   at TMPro.TMP_Text.GetEllipsisSpecialCharacter (TMPro.TMP_FontAsset fontAsset) [0x00000] in <00000000000000000000000000000000>:0
    3.  E Unity   :   at TMPro.TMP_Text.GetSpecialCharacters (TMPro.TMP_FontAsset fontAsset) [0x00000] in <00000000000000000000000000000000>:0
    4.  E Unity   :   at TMPro.TextMeshProUGUI.LoadFontAsset () [0x00000] in <00000000000000000000000000000000>:0
    5.  E Unity   :   at TMPro.TextMeshProUGUI.Awake () [0x00000] in <00000000000000000000000000000000>:0
    6.  
    This message is repeated for every Text Mesh Pro element and the text is not displayed. Unfortunately the problem only occurs on about 50% of the devices.

    The only change compared to the previously working project is the enabled Split Application Binary at the Publishing Settings. I am not using Asset Packs.

    Maybe unity packing some of the required TextMesh Pro asset in the wrong way? Do you have any idea how to solve this?

    I am using Unity 2020.3.18f1, and TextMesh Pro 3.0.6.

    Thanks.
     
    Last edited: Sep 22, 2021
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Split Binary is known to be causing issues.

    Would you be able to submit a bug report with project?
     
  3. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    76
    Thanks, I will try to attach the project.
     
  4. jonathan_h

    jonathan_h

    Unity Technologies

    Joined:
    Jul 29, 2021
    Posts:
    18
    Hi,

    Would it be possible to get list of devices and OS versions this issue has occurred?
     
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,796
    Are there issues even with install time aab split builds?
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I believe so but not 100% certain and it might be device specific.

    Have you run into any issue with it thus far?

    Hopefully we will be able to reproduce the issue and get this addressed by the platform team.
     
  7. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,796
    After looking further into it: Not really actually. We recently released an update removing APK + OBB and moving to AAB Split Binary.

    If we had an error rate of 50% I think we would have been slammed by support e-mails by now, and that hasn't really happened. Also after stumbling upon this thread I took a closer look to the Play Console Vitals and I'm not seeing a spike in issues, so I guess our game is not affected?

    I don't know why AAB split build with install time would cause this though. Supposedly Google Play gets everything and it installs and mounts everything before the app is launched, so everything should be available right away.

    It's not like the old APK + OBB where sometimes the OBB wasn't mounted at launch, or sometimes it wasn't even downloaded at all, so there was a high chance of stuff missing.
     
  8. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    76
    I can reproduce on this device:
    Huawei Honor 4C - Android 6.0

    Users reported on these:
    Motorola moto 5G plus - Android 11
    Xiaomi Redmi 9А - Android 10

    Interestingly, it does not occur on every startup, sometimes it crashes with "Unable to initialize the Unity Engine message". I can't reproduce this, but users reported it.

     
    Last edited: Sep 23, 2021
  9. jonathan_h

    jonathan_h

    Unity Technologies

    Joined:
    Jul 29, 2021
    Posts:
    18
    Hi,

    I was not able to reproduce the issue on my end. I would suggest that you attach a sample project to the bug report as it will help the team reproduce and resolve issue. You could also add the information about the devices (model and OS) which could help speed up the investigation.
     
  10. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    76
    Attached the project. Bug id: 1368287
     
    Stephan_B likes this.
  11. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    76
    Stephan_B likes this.
  12. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    domonyiv likes this.
  13. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    76
    @Stephan_B After more investigating I think I found the problem.

    in TMP_Settings.cs the following line sometimes returns null.
    Code (CSharp):
    1. TMP_Settings.s_Instance = Resources.Load<TMP_Settings>("TMP Settings");
    If I add a script to the main scene with a public TMPro.TMP_Settings variable and assign it, there is no more error message.

    Is the Resources.Load the known issue with Split Binary you mentioned before?
     
  14. JeffTheCampbell

    JeffTheCampbell

    Joined:
    Jul 11, 2018
    Posts:
    35
    Any more updates on this issue? We are seeing this now on our build as well since we switched to using AAB + Split Binary for Android.
     
  15. JeffTheCampbell

    JeffTheCampbell

    Joined:
    Jul 11, 2018
    Posts:
    35
    I've narrowed this down to the Split Binary option + App Bundle being enabled at the same time. Despite the AAB output seeming to be the same size, similar contents, at runtime it's very apparent that none of the Resources content is present and even though loading the Build Settings scenes is successful they are completely empty.

    If Split Binary is disabled, everything works as intended.
     
  16. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,796
    What Unity version are you using?
     
  17. JeffTheCampbell

    JeffTheCampbell

    Joined:
    Jul 11, 2018
    Posts:
    35
    Unity Editor: 2020.3.32f1
    TMP Package: 3.0.6
    Addressables: 1.10.0

    We also use Addressables, in which our Resources are included with the Built-In Data group.
     
  18. mcarriere

    mcarriere

    Joined:
    Sep 14, 2012
    Posts:
    106
    @AcidArrow -- Just as an update, we updated our project to Addressables package 1.18.19 with no luck.
     
  19. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,796
    @Stephan_B @jonathan_h What is the status of this?

    This thread seems very confusing. As mentioned previously in the thread, QA was able to reproduce 1368287, which I can't find on the issue tracker, so I don't know the status.

    The status of another similar issue on the issuetracker says "not reproducible" ( https://issuetracker.unity3d.com/is...n-using-the-unity-play-asset-delivery-feature ).

    Maybe it's an issue with Addressables? I don't know why it would be though. Do you need a new bug report that potentially @mcarriere or @Mirraraenn can supply to you?
     
  20. mcarriere

    mcarriere

    Joined:
    Sep 14, 2012
    Posts:
    106
  21. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I just took a quick look at one of those cases. The latest reply from QA indicated "Could not reproduce the issue on 2020.3.28f1, 2021.2.11f1, 2022.1.0b6, 2022.2.0a4"

    The latest post from @mcarriere indicates that he is using 2020.3.32f1 where this would indicate that it is still reproducible.

    Split binary is most certainly an issue so I wonder if "not reproducible" is related to having split binary disabled.

    This is not specific to TMP but to the use of split binary.

    I'll poke a few people internally to see if I can get more information.
     
    AcidArrow and mcarriere like this.
  22. aubreypuan

    aubreypuan

    Joined:
    Mar 30, 2017
    Posts:
    9
    For the last few months, I am having the exact same issue too (AAB + Split Binary) and it's devices-based. It works perfectly fine on my Xiaomi Mi 10 T, but I had received quite a lot of reports from my players that the game is not working (Says TMP_Text null exception in the logs), so I need to fall back to APK + Split Binary.

    I think it's mainly the split binary/android issue because sometimes I will receive the exact same error report even if I do APK + Split Binary, but the reports I got were a lot less. And some of my players who couldn't get AAB + Split Binary to work at all no matter what they did, they can get APK + Split Binary to work by Reinstall or Clear Data, I can't seem to find a pattern, it's pretty random.

    My Unity Ver: 2021.1.25f1

    I will try Unity Ver 2022.1.0b13 and see if it still happens
     
  23. JeffTheCampbell

    JeffTheCampbell

    Joined:
    Jul 11, 2018
    Posts:
    35
    We figured out what was causing this issue and were able to resolve it. Our local development builds included our remote bundles with our local bundles so that we could test our game locally with Addressables without needing to host local-dev bundles only. The default path of local bundles with a build are in the StreamingAssets folder. It seems like if the size of this is too great then on Android Unity will load Build Settings Scenes, but they will be empty and assets will fail to be loaded from Resources (returned as null).

    Unfortunately no errors are produced warning of this during the build process or at runtime.
     
  24. Laureus

    Laureus

    Joined:
    Jul 11, 2017
    Posts:
    4
    I experienced a similar problem.
    When I created a Split APK the TextMesh Pro isn't working.

    I'm using Unity 2020.3.14f
    Did anybody find a workaround for this? Does upgrading Unity solve this ?
     
  25. aubreypuan

    aubreypuan

    Joined:
    Mar 30, 2017
    Posts:
    9
    Hey there, this issue is still trouble me until this day. Can you share with us how exactly did guys do to resolve it? Should do something with the StreamingAssers folder?
     
  26. mcarriere

    mcarriere

    Joined:
    Sep 14, 2012
    Posts:
    106
    It was a mix of things when the problem resolved itself:
    • We updated to the latest version of Unity at the time; jumping from 2020 LTS to 2021 LTS. (Currently on 2021.3.1f1 with that project.)
    • We updated to the latest version of Addressables at the time. (Currently 1.19.19)
    • We recreated our Addressable Settings data, effectively starting from a new set of Addressable Groups, and repopulated our data from there.
     
    pandolfini likes this.
  27. aubreypuan

    aubreypuan

    Joined:
    Mar 30, 2017
    Posts:
    9
    Thanks for ur sharing, I will try ur methods and see how it goes. Btw may I know did you build ur app into split Android App Bundle (abb), or split apk file?
     
  28. mcarriere

    mcarriere

    Joined:
    Sep 14, 2012
    Posts:
    106
    We're currently shipping to Google Play which requires the AAB delivery method. We do also build APKs for easier sideloading for QA.
     
    pandolfini likes this.
  29. Thaina

    Thaina

    Joined:
    Jul 13, 2012
    Posts:
    1,168
    Have this issue was solved in any version? I use 2021.3.20f
     
  30. mcarriere

    mcarriere

    Joined:
    Sep 14, 2012
    Posts:
    106
    See my post on Sept 4 -- you may need to update your addressable package or recreate your Addressable Settings data.
     
    Thaina likes this.
  31. pandolfini

    pandolfini

    Joined:
    Feb 5, 2020
    Posts:
    17
    This is going to sound like a bit of a rant, so first, thank you to @mcarriere for all his follow-up after solving the problem:

    Addressables is not ready for release, at least as far as what Unity claims it can handle. After testing it several times, the system is far too fragile in production, and it is too easy for a team of greater than one programmer to make an edit that breaks an entire app.

    We have chosen to only use this system in an isolated fashion: if there are specific groups of assets that are large and need to be downloaded remotely at times or carefully loaded and unloaded for memory management purposes, it might make sense to use Addressables for this.

    After seeing bizarre bugs like the above (you can't have "issues with building an .aab with split binary--this is legitimately the only way you can publish to the largest app store in the world!) and dealing with random flickering TMP text, scenes just not loading for whatever reason, and having to rebuild groups for no apparent reason, I would strongly suggest to Unity that they revamp this system and its associated absolutely abysmal documentation, and actually go test in large projects and real-world cases what Addressables is capable of handling.