文档

Unity Engine

Download Unity

Unity Engine

Use the legacy Text Core in UI Toolkit

Enable and use the legacy Text Core in UI Toolkit.
阅读时间1 分钟最后更新于 17 天前

If for some reason you need to use the legacy Text Core in UI Toolkit, you can enable it in UI Builder, USS, and C# scripts.

In UI Builder

To use the legacy Text Core in UI Builder, do the following:
  1. Select the (root) visual element that you want to apply to.
  2. In the
    Inspector

    ?

    panel, select Inlined Styles > Text.
  3. From the Text Generator Type dropdown, select Standard.

In USS

To use Text Core in USS, set
-unity-text-generator
to
standard
. The following USS example sets it for the root element:
:root { -unity-text-generator: standard;}

In C# scripts

To use Text Core in C# scripts, set
TextGeneratorType
to
Standard
. For example:
textElement.style.unityTextGenerator = new StyleEnum<TextGeneratorType>(TextGeneratorType.Standard);