Search Unity

Bug RichText parsing & UIElement Assertion failed.

Discussion in 'UI Toolkit' started by vertxxyz, Dec 28, 2018.

  1. vertxxyz

    vertxxyz

    Joined:
    Oct 29, 2014
    Posts:
    109
    If you add rich text tags to UIElement they are not parsed, but layout is calculated as if they are there.
    Code (CSharp):
    1. Label label = new Label("<color=#FF00FFFF>coloured</color>");
    2. label.ClearClassList();
    3. label.style.alignSelf = Align.FlexStart;
    4. rootVisualElement.Add(label);
    Now we have a label that's the size of the word "coloured" but we actually have the entire label text still in it!
    I'd love a non-hack way to turn off this behaviour whilst it's only partially implemented. I've only managed to recalculate and set the intended size of the text using a load of reflection hacks.


    I'm also regularly getting asserts that are spamming the console from what I can only assume are certain types of nested content:
    Logs presented are from 2019.1.0a12

    FIXED IN a13:
    Code (CSharp):
    1.  
    2. Assertion failed
    3. 0x00007FF706AE19EC (Unity) StackWalker::GetCurrentCallstack
    4. 0x00007FF706AE4EA1 (Unity) StackWalker::ShowCallstack
    5. 0x00007FF705153FA5 (Unity) GetStacktrace
    6. 0x00007FF7074F0D00 (Unity) DebugStringToFile
    7. 0x00007FF706B8D6B9 (Unity) DebugLogHandler_CUSTOM_Internal_Log
    8. 0x000001AB9CB8275B (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
    9. 0x000001AB9CB825DB (Mono JIT Code) [DebugLogHandler.cs:10] UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    10. 0x000001AB9CB87751 (Mono JIT Code) [Logger.cs:61] UnityEngine.Logger:Log (UnityEngine.LogType,object)
    11. 0x000001AB86339946 (Mono JIT Code) [Debug.bindings.cs:175] UnityEngine.Debug:Assert (bool)
    12. 0x000001AB88C7BAC3 (Mono JIT Code) [UIRenderDevice.cs:449] UnityEngine.UIElements.UIR.UIRenderDevice:Allocate (UnityEngine.UIElements.UIR.MeshHandle,uint,uint,Unity.Collections.NativeSlice`1<UnityEngine.UIElements.UIR.Vertex>&,Unity.Collections.NativeSlice`1<uint16>&,bool)
    13. 0x000001AB88C7AFF3 (Mono JIT Code) [UIRenderDevice.cs:344] UnityEngine.UIElements.UIR.UIRenderDevice:Allocate (uint,uint,Unity.Collections.NativeSlice`1<UnityEngine.UIElements.UIR.Vertex>&,Unity.Collections.NativeSlice`1<uint16>&,uint16&)
    14. 0x000001AB88C9032F (Mono JIT Code) [UIRMeshBuilder.cs:80] UnityEngine.UIElements.UIRMeshBuilder:MakeTextMeshHandle (UnityEngine.UIElements.UIR.IUIRenderDevice,Unity.Collections.NativeArray`1<UnityEngine.UIElements.TextVertex>,UnityEngine.Matrix4x4,UnityEngine.UIElements.UIR.MeshHandle,uint,uint)
    15. 0x000001AB88C8A7C3 (Mono JIT Code) [UIRStylePainter.cs:319] UnityEngine.UIElements.UIRStylePainter:DrawText (UnityEngine.UIElements.TextStylePainterParameters,UnityEngine.UIElements.UIR.MeshHandle)
    16. 0x000001AB88C89403 (Mono JIT Code) [UIRStylePainter.cs:297] UnityEngine.UIElements.UIRStylePainter:DrawText (UnityEngine.UIElements.TextStylePainterParameters)
    17. 0x000001AB88C891EB (Mono JIT Code) [UIRStylePainter.cs:542] UnityEngine.UIElements.UIRStylePainter:DrawText (string)
    18. 0x000001AB88C88CA1 (Mono JIT Code) [TextElement.cs:60] UnityEngine.UIElements.TextElement:DoRepaint (UnityEngine.UIElements.IStylePainter)
    19. 0x000001AB869858F6 (Mono JIT Code) [VisualElement.cs:840] UnityEngine.UIElements.VisualElement:Repaint (UnityEngine.UIElements.IStylePainter)
    20. 0x000001AB869841B3 (Mono JIT Code) [UIRStylePainter.cs:96] UnityEngine.UIElements.UIRStylePainter:Paint (UnityEngine.UIElements.UIRenderData)
    21. 0x000001AB86980B83 (Mono JIT Code) [UIRDataChainBuilder.cs:88] UnityEngine.UIElements.UIRDataChainBuilder:TraverseVisualTree (UnityEngine.UIElements.VisualElement,UnityEngine.UIElements.UIRenderData,UnityEngine.UIElements.UIRenderData)
    22. ...
    23. 0x000001AB868EFAA3 (Mono JIT Code) [UIRDataChainBuilder.cs:30] UnityEngine.UIElements.UIRDataChainBuilder:BuildChain (UnityEngine.UIElements.VisualElement)
    24. 0x000001AB89E9FF23 (Mono JIT Code) [UIRDataChainManager.cs:34] UnityEngine.UIElements.UIRDataChainManager:Update ()
    25. 0x000001AB868EDE73 (Mono JIT Code) [UIRRepaintUpdater.cs:186] UnityEngine.UIElements.UIRRepaintUpdater:Update ()
    26. 0x000001AB86874BDF (Mono JIT Code) [VisualTreeUpdater.cs:71] UnityEngine.UIElements.VisualTreeUpdater:UpdateVisualTree ()
    27. 0x000001AB868743F3 (Mono JIT Code) [Panel.cs:589] UnityEngine.UIElements.Panel:Repaint (UnityEngine.Event)
    28. 0x000001AB868735C3 (Mono JIT Code) [UIElementsUtility.cs:241] UnityEngine.UIElements.UIElementsUtility:DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel)
    29. 0x000001AB868730BB (Mono JIT Code) [UIElementsUtility.cs:68] UnityEngine.UIElements.UIElementsUtility:ProcessEvent (int,intptr)
    30. 0x000001AB86872A1E (Mono JIT Code) [GUIUtility.cs:179] UnityEngine.GUIUtility:ProcessEvent (int,intptr)
    31. 0x000001AB86872C43 (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_bool_int_intptr (object,intptr,intptr,intptr)
    32. 0x00007FF8144FBF7B (mono-2.0-bdwgc) [mini-runtime.c:2809] mono_jit_runtime_invoke
    33. 0x00007FF814481F32 (mono-2.0-bdwgc) [object.c:2919] do_runtime_invoke
    34. 0x00007FF81448AF3F (mono-2.0-bdwgc) [object.c:2966] mono_runtime_invoke
    35. 0x00007FF706A7B466 (Unity) scripting_method_invoke
    36. 0x00007FF706A75865 (Unity) ScriptingInvocation::Invoke
    37. 0x00007FF706A70B1A (Unity) ScriptingInvocation::Invoke<bool>
    38. 0x00007FF70411A579 (Unity) Scripting::UnityEngine::GUIUtilityProxy::ProcessEvent
    39. 0x00007FF704FFDE2C (Unity) GUIView::ProcessRetainedMode
    40. 0x00007FF70546E76D (Unity) GUIView::OnInputEvent
    41. 0x00007FF704FFDD3C (Unity) GUIView::ProcessInputEvent
    Much of the content I create has this assert (with TraverseVisualTree repeating various amount of times) and sometimes the UIRenderDevice.cs:449 line being UIRenderDevice.cs:455.
    ^ FIXED IN a13


    REMAINS UNFIXED IN a13:
    Additionally when first opening a window (or after recompiling) I get:
    Code (CSharp):
    1. Trying to read value of type Color while reading a value of type Enum
    2. 0x00007FF6D484B91C (Unity) StackWalker::GetCurrentCallstack
    3. 0x00007FF6D484EDD1 (Unity) StackWalker::ShowCallstack
    4. 0x00007FF6D2E07965 (Unity) GetStacktrace
    5. 0x00007FF6D5285A30 (Unity) DebugStringToFile
    6. 0x00007FF6D48F8E4C (Unity) DebugLogHandler_CUSTOM_Internal_Log
    7. 0x00000152627CD6DB (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
    8. 0x00000152627CD55B (Mono JIT Code) [DebugLogHandler.cs:10] UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    9. 0x00000152627CCEF6 (Mono JIT Code) [Logger.cs:127] UnityEngine.Logger:LogFormat (UnityEngine.LogType,string,object[])
    10. 0x00000152627CCC06 (Mono JIT Code) [Debug.bindings.cs:135] UnityEngine.Debug:LogErrorFormat (string,object[])
    11. 0x000001522CC0640B (Mono JIT Code) [StyleSheet.cs:97] UnityEngine.UIElements.StyleSheet:CheckAccess<UnityEngine.Color> (UnityEngine.Color[],UnityEngine.UIElements.StyleValueType,UnityEngine.UIElements.StyleValueHandle)
    12. 0x000001522CC05F7B (Mono JIT Code) [StyleSheet.cs:203] UnityEngine.UIElements.StyleSheet:ReadColor (UnityEngine.UIElements.StyleValueHandle)
    13. 0x0000015233B24D3B (Mono JIT Code) [StyleSheetExtensions.cs:67] UnityEngine.UIElements.StyleSheets.StyleSheetExtensions:ReadStyleColor (UnityEngine.UIElements.StyleSheet,UnityEngine.UIElements.StyleValueHandle,int)
    14. 0x0000015233B24623 (Mono JIT Code) [StyleSheetApplicator.cs:92] UnityEngine.UIElements.StyleSheets.StyleSheetApplicator:ApplyColor (UnityEngine.UIElements.StyleSheet,UnityEngine.UIElements.StyleValueHandle[],int,UnityEngine.UIElements.StyleColor&)
    15. 0x000001523104CF34 (Mono JIT Code) [VisualElementStylesData.cs:527] UnityEngine.UIElements.StyleSheets.VisualElementStylesData:ApplyStyleProperty (UnityEngine.UIElements.StyleSheets.IStyleSheetApplicator,UnityEngine.UIElements.StyleSheet,UnityEngine.UIElements.StyleSheets.StylePropertyID,UnityEngine.UIElements.StyleValueHandle[],int)
    16. 0x0000015232865133 (Mono JIT Code) [VisualElementStylesData.cs:257] UnityEngine.UIElements.StyleSheets.VisualElementStylesData:ApplyRule (UnityEngine.UIElements.StyleSheet,int,UnityEngine.UIElements.StyleRule,UnityEngine.UIElements.StyleSheets.StylePropertyID[])
    17. 0x000001523178F3CB (Mono JIT Code) [VisualTreeStyleUpdater.cs:315] UnityEngine.UIElements.VisualTreeStyleUpdaterTraversal:ProcessMatchedRules (UnityEngine.UIElements.VisualElement,System.Collections.Generic.List`1<UnityEngine.UIElements.StyleSheets.SelectorMatchRecord>)
    18. 0x000001523178D04B (Mono JIT Code) [VisualTreeStyleUpdater.cs:250] UnityEngine.UIElements.VisualTreeStyleUpdaterTraversal:TraverseRecursive (UnityEngine.UIElements.VisualElement,int)
    19. 0x00000152314CCCBA (Mono JIT Code) [HierarchyTraversal.cs:27] UnityEngine.UIElements.StyleSheets.HierarchyTraversal:Recurse (UnityEngine.UIElements.VisualElement,int)
    20. 0x000001523178D4F3 (Mono JIT Code) [VisualTreeStyleUpdater.cs:273] UnityEngine.UIElements.VisualTreeStyleUpdaterTraversal:TraverseRecursive (UnityEngine.UIElements.VisualElement,int)
    21. 0x00000152314CCCBA (Mono JIT Code) [HierarchyTraversal.cs:27] UnityEngine.UIElements.StyleSheets.HierarchyTraversal:Recurse (UnityEngine.UIElements.VisualElement,int)
    22. 0x000001523178D4F3 (Mono JIT Code) [VisualTreeStyleUpdater.cs:273] UnityEngine.UIElements.VisualTreeStyleUpdaterTraversal:TraverseRecursive (UnityEngine.UIElements.VisualElement,int)
    23. 0x00000152314CCCBA (Mono JIT Code) [HierarchyTraversal.cs:27] UnityEngine.UIElements.StyleSheets.HierarchyTraversal:Recurse (UnityEngine.UIElements.VisualElement,int)
    24. 0x000001523178D4F3 (Mono JIT Code) [VisualTreeStyleUpdater.cs:273] UnityEngine.UIElements.VisualTreeStyleUpdaterTraversal:TraverseRecursive (UnityEngine.UIElements.VisualElement,int)
    25. 0x00000152314CCCBA (Mono JIT Code) [HierarchyTraversal.cs:27] UnityEngine.UIElements.StyleSheets.HierarchyTraversal:Recurse (UnityEngine.UIElements.VisualElement,int)
    26. 0x000001523178D4F3 (Mono JIT Code) [VisualTreeStyleUpdater.cs:273] UnityEngine.UIElements.VisualTreeStyleUpdaterTraversal:TraverseRecursive (UnityEngine.UIElements.VisualElement,int)
    27. 0x00000152314CCCBA (Mono JIT Code) [HierarchyTraversal.cs:27] UnityEngine.UIElements.StyleSheets.HierarchyTraversal:Recurse (UnityEngine.UIElements.VisualElement,int)
    28. 0x000001523178D4F3 (Mono JIT Code) [VisualTreeStyleUpdater.cs:273] UnityEngine.UIElements.VisualTreeStyleUpdaterTraversal:TraverseRecursive (UnityEngine.UIElements.VisualElement,int)
    29. 0x00000152314CA132 (Mono JIT Code) [HierarchyTraversal.cs:12] UnityEngine.UIElements.StyleSheets.HierarchyTraversal:Traverse (UnityEngine.UIElements.VisualElement)
    30. 0x000001523178C663 (Mono JIT Code) [VisualTreeStyleUpdater.cs:124] UnityEngine.UIElements.VisualTreeStyleUpdater:ApplyStyles ()
    31. 0x000001523178C003 (Mono JIT Code) [VisualTreeStyleUpdater.cs:108] UnityEngine.UIElements.VisualTreeStyleUpdater:Update ()
    32. 0x0000015231789CF5 (Mono JIT Code) [VisualTreeUpdater.cs:72] UnityEngine.UIElements.VisualTreeUpdater:UpdateVisualTree ()
    33. 0x00000152317895AB (Mono JIT Code) [Panel.cs:592] UnityEngine.UIElements.Panel:Repaint (UnityEngine.Event)
    34. 0x00000152317887C3 (Mono JIT Code) [UIElementsUtility.cs:241] UnityEngine.UIElements.UIElementsUtility:DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel)
    35. 0x00000152317882BB (Mono JIT Code) [UIElementsUtility.cs:68] UnityEngine.UIElements.UIElementsUtility:ProcessEvent (int,intptr)
    36. 0x0000015231787C1E (Mono JIT Code) [GUIUtility.cs:179] UnityEngine.GUIUtility:ProcessEvent (int,intptr)
    37. 0x0000015231787E43 (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_bool_int_intptr (object,intptr,intptr,intptr)
    38. 0x00007FFFE6E9BEEB (mono-2.0-bdwgc) [mini-runtime.c:2809] mono_jit_runtime_invoke
    39. 0x00007FFFE6E21E62 (mono-2.0-bdwgc) [object.c:2919] do_runtime_invoke
    40. 0x00007FFFE6E2AE6F (mono-2.0-bdwgc) [object.c:2966] mono_runtime_invoke
    41. 0x00007FF6D47E2676 (Unity) scripting_method_invoke
    42. 0x00007FF6D47DC985 (Unity) ScriptingInvocation::Invoke
    43. 0x00007FF6D47D751A (Unity) ScriptingInvocation::Invoke<bool>
    44. 0x00007FF6D1D475B9 (Unity) Scripting::UnityEngine::GUIUtilityProxy::ProcessEvent
    45. 0x00007FF6D2CA14EC (Unity) GUIView::ProcessRetainedMode
    46. 0x00007FF6D313A65D (Unity) GUIView::OnInputEvent
    47. 0x00007FF6D2CA13FC (Unity) GUIView::ProcessInputEvent
     
    Last edited: Jan 5, 2019
  2. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,231
    This is clearly a bug (both the rich text tags causing the text to wrap and the remaining UIR asserts). Please submit them as bugs. You can do this right from Unity (that's easiest) using the Bug Reporter.
     
    vertxxyz likes this.
  3. vertxxyz

    vertxxyz

    Joined:
    Oct 29, 2014
    Posts:
    109
    Thanks, Case 1115452 & 1115455.
     
    uDamian likes this.
  4. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
  5. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,231
    Correct, RichText tags will only be supported at the end of 2020.

    That said, there is a bug reported, which was previously closed but was re-opened, which should be fixed sooner and might get a backport to 2019.3.
    https://issuetracker.unity3d.com/is...-was-clicked-when-whitespace-is-set-to-normal

    This seems like a duplicate of 1115452 (reported above) - as in the fix for one should fix the other. CORRECTION: 1115452 appears to be fixed in 2019.3.

    To reiterate:
    1. Actual RichText tags support will not come until late 2020.
    2. Bugs related to RichText tags are being tracked and might get backported.
     
    Last edited: Mar 26, 2020
  6. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    I'm more confused now! So they right now should work (and buggy), but are not supported?
     
  7. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,231
    They are currently not supported which means they should "do nothing". However, UI Toolkit (formally UIElements) shares some of the text backend with IMGUI and uGUI and that backend does know about RichText tags. This is causing bugs where parts of the code know about tags, others don't.

    So, right now, the tags should do nothing (including not causing bugs). In the future, they will change the styling of the text as expected.
     
    JoNax97 and fherbst like this.