文档

Unity Engine

Unity Engine

LocalizedFontAsset

A serializable reference to a localized font asset for UI Toolkit text.
阅读时间2 分钟最后更新于 1 个月前

Definition

public class LocalizedFontAsset : LocalizedAsset<FontAsset>

Remarks

A LocalizedFontAsset is a LocalizedAsset<TObject> specialized for FontAsset, so it can be serialized and shown in the Inspector. Use it for UI Toolkit text, and LocalizedFont for legacy text.
Load a localized font asset.

Examples

using Unity.Localization;using UnityEngine;using UnityEngine.TextCore.Text;namespace Unity.Localization.Samples{ public class LocalizedFontAssetExample { public async Awaitable Load() { var localizedFontAsset = new LocalizedFontAsset(); localizedFontAsset.SetReference("My Assets", "UI FONT ASSET"); FontAsset fontAsset = await localizedFontAsset.GetLocalizedAssetAsync(); if (fontAsset != null) Debug.Log(fontAsset.name); } }}

Inheritance