Hello everyone ![]()
I encounter an issue on the unity version 2023.2.11f1.
I reproduce it in the unity version 6000.0.10f1 and 6000.0.22f1
To give you some context :
We have in our current project many Sprites Atlas for different kind and size of icons.
Currently we want to have the possibility to add some sprite of this atlas inside text of our Labels of UIToolkit (via the RichTag system).
I use and follow this documentation to do that ![]()
So currently i have :
My PanelSettings with my TextSettings
My TextSettings with my PlaceHolder Sprite Asset
My PlaceHolder Sprite Asset with 2 Fallback sprite assets
Two labels with this content:
- < sprite name=“FlagsIcons32IconsBoard_0” >
- < sprite name=“GlobalIcons32IconBoard_30” >
In Editor play, i can’t see my icons for a repro of 1/5 and have one of the three exceptions throw (see bellow)
In a windows build, i can’t see my icons for a repro of 9/10 and have one of the three exceptions throw (see bellow)
I already know it’s normal i can’t see my icon inside the UIBuilder and i haven’t any problems, if I try to open an UXML with this label (i just have the tag visible as a text, but no exception)
Exceptions list :
- Most of the time =>
> InvalidCastException: Specified cast is not valid.
> UnityEngine.TextCore.Text.TextGenerator.ParsingPhase
- OR less often
> NullReferenceException: Object reference not set to an instance of an object
> UnityEngine.TextCore.Text.TextGenerator.ParsingPhase
- OR rarely
> InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
> System.Collections.Generic.HashSet`1[T].AddIfNotPresent (T value) (at <f938b75b1c74449db620e9bbd958bc0a>:0)
> System.Collections.Generic.HashSet`1[T].Add (T item) (at <f938b75b1c74449db620e9bbd958bc0a>:0)
> UnityEngine.TextCore.Text.SpriteAsset.SearchForSpriteByHashCodeInternal
After some test i have a “workaround”.
If i don’t specify Fallback sprite assets and use only one sprite asset, i don’t have any of this exception and everything is fine … but it’s a bit restrictive …
Have you some advice about this subject ? Have I done everything correctly or does this indeed seem to be a bug ?
Thanks


