使用UI Elements:
"com.unity.ui": "1.0.0-preview.12",
"com.unity.ui.builder": "1.0.0-preview.9"
为UIElements.Label设置较长的中文字符串时,并将其设置为自动换行时,发现始终会报空指针。大概是下面这种报错:
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.TextCore.Text.TextGenerator.CalculatePreferredValues (System.Single defaultFontSize, UnityEngine.Vector2 marginSize, System.Boolean ignoreTextAutoSizing, UnityEngine.TextCore.Text.TextGenerationSettings generationSettings, UnityEngine.TextCore.Text.TextInfo textInfo) (at Library/PackageCache/com.unity.textcore@1.0.0-preview.2/Scripts/Runtime/TextGenera