LocalizedFontAsset
A serializable reference to a localized font asset for UI Toolkit text.
Read time 2 minutesLast updated 5 days ago
Definition
- Type: Class
- Namespace: Unity.Localization
- Assembly: UnityEngine.LocalizationRuntimeModule
- Inherits from: LocalizedAsset<FontAsset>
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.
Additional Resources: LocalizedAsset<TObject>, ResourceDatabase
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); } }}