Search Unity

TextMesh Pro NullReferenceException on TMPro.TMP_Text.FillCharacterVertexBuffers (Int32 i, Int32 index_X4)

Discussion in 'UGUI & TextMesh Pro' started by QuantumCalzone, Apr 8, 2017.

  1. QuantumCalzone

    QuantumCalzone

    Joined:
    Jan 9, 2010
    Posts:
    262
    Anyone else getting this error when changing TextMeshProUGUI via scripts?

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. TMPro.TMP_Text.FillCharacterVertexBuffers (Int32 i, Int32 index_X4)
    3. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    4. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    5. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    6. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    7. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    8. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    9. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    10. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    11. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    12. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    13. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    14. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    15. TMPro.TextMeshProUGUI.OnPreRenderCanvas ()
    16. TMPro.TextMeshProUGUI.Rebuild (CanvasUpdate update)
    I'm still trying to get the exact reproduction steps down but it seems to be caused by stemming from a unity UI call

    This was happening to me in the latest Unity 5.5 release but its still happening with 5.6 and the new TextMeshPro release.
     
  2. QuantumCalzone

    QuantumCalzone

    Joined:
    Jan 9, 2010
    Posts:
    262
    ah wait nvm lol, was setting the text to a null string.

    Just had to do a forum post for me to find that error!
     
  3. QuantumCalzone

    QuantumCalzone

    Joined:
    Jan 9, 2010
    Posts:
    262
    Aw man its happening again! Not from a null string this time since I check the string before the TextMeshProUGUI is set. Any ideas !?! :,(
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    What are you trying to change via scripting?

    Just changing the text should not result in any of these errors. Perhaps you could provide an example of the script you are using that produces these errors or provide a repro of the scene / project producing these errors.
     
  5. QuantumCalzone

    QuantumCalzone

    Joined:
    Jan 9, 2010
    Posts:
    262
    it's hard to isolate with the since I think the stack trace is cut off from the stack trace "UnityEngine.UI.ScrollRect.LateUpdate()" if I'm not mistaken. I can reproduce the error in my big project just fine. Trying to figure out what exactly is going on to put in an empty project for u...

    the full stack is
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. TMPro.TMP_Text.FillCharacterVertexBuffers (Int32 i, Int32 index_X4)
    3. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    4. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    5. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    6. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    7. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    8. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    9. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    10. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    11. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    12. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    13. TMPro.TextMeshProUGUI.OnPreRenderCanvas ()
    14. TMPro.TextMeshProUGUI.Rebuild (CanvasUpdate update)
    15. 0. UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate()    C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/CanvasUpdateRegistry.cs:149
    16. 1. UnityEngine.UI.ScrollRect.LateUpdate()
     
  6. QuantumCalzone

    QuantumCalzone

    Joined:
    Jan 9, 2010
    Posts:
    262
    So I couldn't isolate what was broken in an empty project. It had something to do with richText and autoSizing though because when I disabled those the reproducible cases ceased and vice-versa when I re-enabled them.

    I did make a hacky fix though!
    This is my gross code that consistently made the error stop.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using TMPro;
    4.  
    5. public class hackyTmpFix : MonoBehaviour {
    6.  
    7.     [SerializedField] private TextMeshProUGUI tPro;
    8.     private bool waitAndSetOnEnable = false;
    9.  
    10.     private void OnEnable () { if (waitAndSetOnEnable) StartCoroutine(waitAndSet()); }
    11.  
    12.     public void setText (string valueToSet) {
    13.  
    14.         tPro.richText = false;
    15.         tPro.enableAutoSizing = false;
    16.  
    17.         tPro.text = valueToSet;
    18.  
    19.         if (!gameObject.activeInHierarchy) {
    20.             waitAndSetOnEnable = true;
    21.         } else StartCoroutine(waitAndSet());
    22.  
    23.     }
    24.  
    25.     private IEnumerator waitAndSet () {
    26.  
    27.         yield return new WaitForEndOfFrame();
    28.  
    29.         tPro.richText = true;
    30.         tPro.enableAutoSizing = true;
    31.  
    32.         waitAndSetOnEnable = false;
    33.     }
    34.  
    35. }
    36.  
     
  7. Costiome

    Costiome

    Joined:
    Dec 7, 2013
    Posts:
    1
    I encountered the same problem, your fix is working, thank you !
     
  8. RRodriguezMT

    RRodriguezMT

    Joined:
    Sep 29, 2016
    Posts:
    1
    Hey, so I debugged this today and it looks like the problem is that sometimes going into OnPreRenderCanvas() the m_isCalculatingPreferredValues is set to true.

    This in turn makes the function SetArraySizes() - we get there through ParseInputText() - to exit early, which in turn skips the memory allocation for the m_textInfo.meshInfo. The nullref happens when accessing any array in meshInfo which in this case the first one to be accessed happens to be vertices.

    My fix for now is setting the m_isCalculatingPreferredValues to false before the call to OnPreRenderCanvas() inside the Rebuild() function. My reasoning being that if we are rebuilding then we are not just checking the values, we want a full check of the memory, etc. From what I can gather, the worst case scenario is that we don't skip the memory checks/allocations and then the program will run a bit slower, but that is better than a nullrefexception.

    TextMeshProUGUI.cs
    Code (CSharp):
    1. public override void Rebuild(CanvasUpdate update)
    2.         {
    3.             if (this == null) return;
    4.  
    5.             if (update == CanvasUpdate.Prelayout)
    6.             {
    7.                 if (m_autoSizeTextContainer)
    8.                 {
    9.                     m_rectTransform.sizeDelta = GetPreferredValues(Mathf.Infinity, Mathf.Infinity);
    10.                 }
    11.             }
    12.             else if (update == CanvasUpdate.PreRender)
    13.             {
    14.                 m_isCalculatingPreferredValues = false; // I added this line
    15.                 OnPreRenderCanvas();
    16.  
    17.                 m_verticesAlreadyDirty = false;
    18.                 m_layoutAlreadyDirty = false;
    19.  
    20.                 if (!m_isMaterialDirty) return;
    21.  
    22.                 UpdateMaterial();
    23.                 m_isMaterialDirty = false;
    24.             }
    25.         }
    @Stephan_B
     
    Last edited: May 10, 2017
  9. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
  10. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    In our case, disabling Auto Size on one of the many TMProUGUIs in the project fixes the problem for now, but that might break again at any moment so we're going with some kind of code change similar to that proposed by @RRodriguezMT, or a hack that makes the null ref stop and marks the Graphic dirty so it will rebuild again, but eager to hear from @Stephan-B, @Stephan_B how bad an idea the forcing everything to rebuild may or may not be.
     
  11. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I would need a Repro project (submitted via the bug report with case #) that would enable me to reproduce the behavior. This would allow me to figure out why you are getting the error in the first place and determine how to properly address it.

    Opps! posted on the wrong account
     
    Last edited by a moderator: May 12, 2017
  12. QuantumCalzone

    QuantumCalzone

    Joined:
    Jan 9, 2010
    Posts:
    262
    Wish I could implement this but I'm on the free DLL version of TMP so i guess ill have to wait for an update ^_^
     
  13. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I could still use a bug report that reliably reproduces the reported behavior. If you submit the bug report, please provide me with the case #.
     
  14. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    @Stephan_B

    Hey man, was any progress ever made on this one? We've got an application that's throwing this now in very very rare cases. Working to isolate it, but it's buried deep (and is working 99.9% of the time).

    IndexOutOfRangeException: Array index is out of range.

    Code (csharp):
    1.  
    2. TMPro.TMP_Text.FillCharacterVertexBuffers (Int32 i, Int32 index_X4)
    3. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    4. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    5. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    6. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    7. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    8. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    9. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    10. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    11. TMPro.TextMeshProUGUI.GenerateTextMesh ()
    12. TMPro.TextMeshProUGUI.OnPreRenderCanvas ()
    13. TMPro.TextMeshProUGUI.Rebuild (CanvasUpdate update)
    14. UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate ()
    15. UnityEngine.UI.ScrollRect:set_horizontalNormalizedPosition(Single)
    16.  
     
  15. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    Referring the the TMPro forums and the release notes for 10a:

    Fixed a potential OutOfRangeException error in the FillCharacterVertexBuffers() which could occur when using text auto sizing and layout components. Beta 10a

    Is that the issue I'm hitting?!?

    PS... can you link me over to your forum or someplace where this item is discussed in more detail? I'd like to read up on the background behind this fix to see for myself it's a direct match to what I'm hitting (also, any idea what TMPro rev introduced this issue?)
     
    Last edited: Jun 26, 2017
  16. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Here is the link to the potential thread http://digitalnativestudios.com/forum/index.php?topic=1512.msg11580#msg11580 which can be uncovered by searching for 10a or the error you reported.

    This potential issue would have been around for a while and was more like an oversight on my part.
     
  17. samlabs_lea

    samlabs_lea

    Joined:
    May 1, 2018
    Posts:
    7
    I am seeing the exact same problem in Unity 2018.2.0f2 with the current version of TextMesh Pro that is distributed via the Unity Package Manager. The dirty hack of turning auto size off and on again works.
     
  18. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Can you provide the text and settings that are causing this behavior or some project sample that would enable me to look at it?
     
  19. samlabs_lea

    samlabs_lea

    Joined:
    May 1, 2018
    Posts:
    7
    @Stephan_B I created a minimal repro project although this is not throwing the exception, it still isn't behaving correctly. The text object is inside a prefab which is instantiated by a script. The text does not render until the "AutoSize" property is turned off and then on again using the Inspector. Case 1067717

    I will see if I can put a basic repro case together that throws the exception. Our project reliably throws the exception every time upon instantiating our prefab.
     
  20. RFredW_Exient

    RFredW_Exient

    Joined:
    Mar 29, 2017
    Posts:
    3
    Here’s a fairly small repro case. The (rich) text itself and the presence of a (horizontal in this case) layout group appears to be the key.
    (First time uploading a file here, hope it works)
    I’m running 2018.1.3f1, for what it’s worth.
    * Open up project
    * Open TestScene
    * Run
    * Instantiated blue box doesn’t render text, exception occurs
    * Select text (CanvasUI / PopupContainter / Buttons / Button1 / PopupButtonSticker(Clone)/StickerText)
    * Turn “auto size” off (Text is shown)
    * Turn “auto size” on (Text remains)
     

    Attached Files:

    Claytonious likes this.
  21. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Thank you for providing the Repro, I'll try taking a look in the next few days and provide feedback thereafter.
     
    Claytonious likes this.
  22. Sir_Everard

    Sir_Everard

    Joined:
    Feb 5, 2015
    Posts:
    5
    Sorry to bring up an old thread.

    Is there a fix for this, or a known cause?
    Had this issue today, I fixed it by deleting the submesh and letting tmp regenerate the submesh.
    @Stephen_B
     
    Headup_Dev likes this.
  23. Headup_Dev

    Headup_Dev

    Joined:
    Sep 18, 2013
    Posts:
    23
    Same here, I experience the same issue with a horizontal Layout Group and a TextMeshProUGUI component on a child gameobject.
    Unity version is 2019.1.8f1 and TextMesh Pro version 2.0.1
     
  24. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Can you provide me with a Repro project or submit a bug report with the project? Please be sure to provide me with the Case # once you have it.
     
  25. Ferazel

    Ferazel

    Joined:
    Apr 18, 2010
    Posts:
    517
    @Stephan_B , we encountered this problem today on one of our labels with some peculiar label RTF and Auto-Size enabled. I spent the time to get a repro project so this thing can hopefully be fixed.

    I was able to reproduce this on 2018.4.8 with TMP 1.4.1.

    Bug# 1183870

    If you need more information please let me know.
     
  26. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Thank you for submitting the bug report. I'll try taking a look tomorrow or over the weekend.
     
  27. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Just tested the provided repro project against version 1.4.1 and was able to reproduce the issue. Tested the same project against the new release 1.5.0-preview.1 and everything worked as expected.

    Although I am not getting any errors with the new release, I am looking deeper into the issue with the previous release to understand the original source of that behavior.
     
    Ferazel likes this.
  28. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    @Ferazel I did find the root cause of this behavior which would have not been possible without the repro project you provided. So thank you again for the time you took to prepare / provide this.

    The issue was related to a combination of text auto-sizing, values set for the auto size, layout components and preferred value calculation / handling. This issue would not have occurred in the next release as a result of changes I made to improve handling of auto-size and most of the text overflow modes but wanted to know exactly the cause of the issue before moving on / release the next TMP package. As usual, the fix in the current version is trivial but would have continue to elude us / remain nearly impossible to find without the repro project you provided.

    Figuring this out added an extra day on the release of the new version but in my opinion totally worth it given this issue had been out there for a long time. I'll be doing additional testing tomorrow on some other issues to make sure all is good and then moving forward with the release.
     
    Headup_Dev likes this.
  29. Ferazel

    Ferazel

    Joined:
    Apr 18, 2010
    Posts:
    517
    @Stephan_B That's great to hear that you were able to get it fixed and that my repro was helpful. We will look forward to it in the next TMP release. TMP upgrades are pretty cautious around here so we may not jump on it immediately. Is it viable to fix this in an earlier package? If it involves a lot of potentially breaking changes, then we can wait to update, but I figure I'd ask.
     
  30. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    In the TMP_Text.cs file in all the GetPreferredWidth() or GetPreferredHeight() function where m_isCalculatingPreferredValues = true; We need to set it back to false before the function is exited.

    So make the following / similar changes in those functions.

    Code (csharp):
    1.  
    2. /// <summary>
    3. /// Method to calculate the preferred width of a text object.
    4. /// </summary>
    5. /// <returns></returns>
    6. protected float GetPreferredWidth()
    7. {
    8.        if (TMP_Settings.instance == null)
    9.            return 0;
    10.  
    11.        float fontSize = m_enableAutoSizing ? m_fontSizeMax : m_fontSize;
    12.  
    13.        // Reset auto sizing point size bounds
    14.        m_minFontSize = m_fontSizeMin;
    15.        m_maxFontSize = m_fontSizeMax;
    16.        m_charWidthAdjDelta = 0;
    17.  
    18.        // Set Margins to Infinity
    19.        Vector2 margin = k_LargePositiveVector2;
    20.        if (m_isInputParsingRequired || m_isTextTruncated)
    21.        {
    22.             m_isCalculatingPreferredValues = true;
    23.             ParseInputText();
    24.        }
    25.  
    26.        m_AutoSizeIterationCount = 0;
    27.  
    28.        float preferredWidth = CalculatePreferredValues(fontSize, margin, true).x;
    29.  
    30.        m_isPreferredWidthDirty = false;
    31.        // Add this new line below
    32.        m_isCalculatingPreferredValues = false;
    33.  
    34.        return preferredWidth;
    35. }
    36.  
    Again this change needs to be made in all the GetPreferred functions where the m_isCalculatingPreferredValues is set to true before calling CalculatePreferredValues();

    Let me know how these changes behave in the previous version. The new release brings improvement to all of this so it would be great if you could still test your application against the new release preview. It should all be good but better catch potential issues in the preview then later.
     
    Headup_Dev likes this.
  31. Ferazel

    Ferazel

    Joined:
    Apr 18, 2010
    Posts:
    517
    Hmm, I tested your request in my code and unless I'm missing something the problem is still present in the 2018.4.8.

    I updated GetPreferredValues(), GetPreferredValues(float, float), GetPreferredValues(string), GetPreferredValues(string, float, float), GetPreferredWidth(), GetPreferredHeight(), CalculatePreferredValues(float, Vector2, bool).

    As long as it gets fixed in a future version I think that should be fine. Thanks!
     
    Headup_Dev likes this.
  32. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Please verify the fix made was made in the global package cache as fixes in the local cache in Library/PackageCache/com.unity.textmeshpro@... will be overwritten by the global cache thus undoing the change.

    Ie. Editing the file from inside Unity by navigating to the Packages folder ends up making the change in the local package cache.

    P.S. I just re-opened your project and made the following two changes.

    Code (csharp):
    1.  
    2. /// <summary>
    3. /// Method to calculate the preferred width of a text object.
    4. /// </summary>
    5. /// <returns></returns>
    6. protected float GetPreferredWidth()
    7. {
    8.     if (TMP_Settings.instance == null) return 0;
    9.     float fontSize = m_enableAutoSizing ? m_fontSizeMax : m_fontSize;
    10.     // Reset auto sizing point size bounds
    11.     m_minFontSize = m_fontSizeMin;
    12.     m_maxFontSize = m_fontSizeMax;
    13.     m_charWidthAdjDelta = 0;
    14.     // Set Margins to Infinity
    15.     Vector2 margin = k_LargePositiveVector2;
    16.     if (m_isInputParsingRequired || m_isTextTruncated)
    17.     {
    18.         m_isCalculatingPreferredValues = true;
    19.         ParseInputText();
    20.     }
    21.     m_recursiveCount = 0;
    22.     float preferredWidth = CalculatePreferredValues(fontSize, margin, true).x;
    23.     m_isPreferredWidthDirty = false;
    24.     m_isCalculatingPreferredValues = false; // added this new line at 3571
    25.     //Debug.Log("GetPreferredWidth() Called at frame " + Time.frameCount + ". Returning width of " + preferredWidth);
    26.     return preferredWidth;
    27. }
    Code (csharp):
    1.  
    2. /// <summary>
    3. /// Method to calculate the preferred height of a text object.
    4. /// </summary>
    5. /// <returns></returns>
    6. protected float GetPreferredHeight()
    7. {
    8.     if (TMP_Settings.instance == null) return 0;
    9.     float fontSize = m_enableAutoSizing ? m_fontSizeMax : m_fontSize;
    10.     // Reset auto sizing point size bounds
    11.     m_minFontSize = m_fontSizeMin;
    12.     m_maxFontSize = m_fontSizeMax;
    13.     m_charWidthAdjDelta = 0;
    14.     Vector2 margin = new Vector2(m_marginWidth != 0 ? m_marginWidth : k_LargePositiveFloat, k_LargePositiveFloat);
    15.     if (m_isInputParsingRequired || m_isTextTruncated)
    16.     {
    17.         m_isCalculatingPreferredValues = true;
    18.         ParseInputText();
    19.     }
    20.     m_recursiveCount = 0;
    21.     float preferredHeight = CalculatePreferredValues(fontSize, margin, !m_enableAutoSizing).y;
    22.     m_isPreferredHeightDirty = false;
    23.     m_isCalculatingPreferredValues = false; // added this new line at 3629
    24.     //Debug.Log("GetPreferredHeight() Called. Returning height of " + preferredHeight);
    25.     return preferredHeight;
    26. }
     
    Last edited: Sep 27, 2019
    Headup_Dev likes this.
  33. MaratZahidylin

    MaratZahidylin

    Joined:
    May 21, 2020
    Posts:
    1
    Hi. In which release this fix is available?
    We are using 2.0.1

    And get this in Crashlytincs from users devices (but unable to reproduce in editor):

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2.  
    3. Managed Stack Trace:
    4.  
    5. TMPro.TextMeshProUGUI.GenerateTextMesh () (at <00000000000000000000000000000000>:0)
    6. TMPro.TextMeshProUGUI.Rebuild (UnityEngine.UI.CanvasUpdate update) (at <00000000000000000000000000000000>:0)
    7. UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at <00000000000000000000000000000000>:0)
    8. UnityEngine.Canvas+WillRenderCanvases.Invoke () (at <00000000000000000000000000000000>:0)
    9. UnityEngine.UI.ScrollRect.LateUpdate () (at <00000000000000000000000000000000>:0)
    10. UnityEngine.UI.ScrollRect:LateUpdate()
     
  34. dadamsj1

    dadamsj1

    Joined:
    Jul 25, 2017
    Posts:
    42
    @Stephan_B I am also having a similar problem using 2.0.1 from Crash Analytics but I cannot reproduce otherwise. Is there a fix for this?

    Code (CSharp):
    1. NullReferenceException
    2.  
    3. TMPro.TextMeshProUGUI.GenerateTextMesh () (at <cfe537f9c1ea47ebbc4f48f3a8e177f8>:0)
    4. TMPro.TextMeshProUGUI.OnPreRenderCanvas () (at <cfe537f9c1ea47ebbc4f48f3a8e177f8>:0)
    5. TMPro.TextMeshProUGUI.UpdateSDFScale (System.Single scaleDelta) (at <cfe537f9c1ea47ebbc4f48f3a8e177f8>:0)
    6. TMPro.TextMeshProUGUI.InternalUpdate () (at <cfe537f9c1ea47ebbc4f48f3a8e177f8>:0)
    7. TMPro.TMP_UpdateManager.DoRebuilds () (at <cfe537f9c1ea47ebbc4f48f3a8e177f8>:0)
    8. TMPro.TMP_UpdateManager.OnCameraPreCull (UnityEngine.Camera cam) (at <cfe537f9c1ea47ebbc4f48f3a8e177f8>:0)
    9. UnityEngine.Camera.FireOnPreCull (UnityEngine.Camera cam) (at <97fdf0a75ab94da9a7e5188c186e574d>:0)
     
    Last edited: Jun 19, 2020
  35. patrik-org

    patrik-org

    Joined:
    Sep 10, 2012
    Posts:
    100
    Using 2.1.1 and still get this issue.
     
  36. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Are you able to reliably reproduce this issue?

    If so, can you please submit a bug report with the project and steps to reproduce so I can take a closer look?
     
  37. patrik-org

    patrik-org

    Joined:
    Sep 10, 2012
    Posts:
    100
    It's reliably reproduced in my project, it's not easy to create a stripped down version that I can share though. I found out that the problem arises if I access preferredWidth / preferredHeight on the TextMeshProUGUI component, it throws the exception:

    I swallow those exceptions but it seems like it the text-mesh component is put into a state that gives rise to the error in this thread. If I remove access to preferredWidth the error above goes away and the subsequent one below goes away:

     
    Last edited: Aug 31, 2020
  38. laikha

    laikha

    Joined:
    Jan 24, 2021
    Posts:
    1
    Hi!! I took the same error. When I was testing in emulator. This is the error of logcat.

    03-06 10:53:31.061 11742 11769 D CompatibilityChangeReporter: Compat change id reported: 147600208; UID 10153; state: ENABLED
    03-06 10:53:31.946 327 327 I android.hardware.vibrator-service.example: Vibrator reporting capabilities
    03-06 10:53:31.985 11742 11769 E Unity : NullReferenceException: Object reference not set to an instance of an object.
    03-06 10:53:31.985 11742 11769 E Unity : at TMPro.TMP_Settings.get_defaultStyleSheet () [0x00000] in <00000000000000000000000000000000>:0
    03-06 10:53:31.985 11742 11769 E Unity : at TMPro.TMP_Text.GetStyle (System.Int32 hashCode) [0x00000] in <00000000000000000000000000000000>:0
    03-06 10:53:31.985 11742 11769 E Unity : at TMPro.TMP_Text.get_textStyle () [0x00000] in <00000000000000000000000000000000>:0
    03-06 10:53:31.985 11742 11769 E Unity : at TMPro.TMP_Text.StringToInternalParsingBuffer (System.String sourceText, TMPro.TMP_Text+UnicodeChar[]& internalParsingArray) [0x00000] in <00000000000000000000000000000000>:0
    03-06 10:53:31.985 11742 11769 E Unity : at TMPro.TMP_Text.ParseInputText () [0x00000] in <00000000000000000000000000000000>:0
    03-06 10:53:31.985 11742 11769 E Unity : at TMPro.TextMeshProUGUI.OnPreRenderCanvas () [0x00000] in <00000000000000000000000000000000>:0
    03-06 10:53:31.985 11742 11769 E Unity : at TMPro.TextMeshProUGUI.Rebuild (UnityEngine.UI.CanvasUpdate update) [0x00000] in <00000000000000000000000000000000>:0
    03-06 10:53:31.985 11742 11769 E Unity : at UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () [0x00000] in <00000000000000000000000000000000>:0
    03-06 10:53:31.985 11742 11769 E Unity : at UnityEngine.Canvas+WillRenderCanvases.Invoke ()
    03-06 10:53:33.785 3099 10120 W FlatFileLogStore: Excessive logging: 256 events, 192000 bytes from log source ANDROID_GSA last 0s
    03-06 10:53:49.077 215 223 E android.system.suspend@1.0-service: Error opening kernel wakelock stats for: wakeup34: Permission denied
    03-06 10:53:49.082 215 223 E android.system.suspend@1.0-service: Error opening kernel wakelock stats for: wakeup35: Permission denied
    03-06 10:53:49.073 215 215 W Binder:215_2: type=1400 audit(0.0:217): avc: denied { read } for name="wakeup34" dev="sysfs" ino=18754 scontext=u:r:system_suspend:s0 tcontext=u:eek:bject_r:sysfs:s0 tclass=dir permissive=0
     

    Attached Files: