前面的返回按钮, 以及自己试验的一些Icon都不显示, 然后回去翻UIWidgets的README
public class UIWidgetsExample : UIWidgetsPanel { protected override void OnEnable() { // if you want to use your own font or font icons. // FontManager.instance.addFont(Resources.Load<Font>(path: "path to your font"), "font family name"); // load custom font with weight & style. The font weight & style corresponds to fontWeight, fontStyle of // a TextStyle object // FontManager.instance.addFont(Resources.Load<Font>(path: "path to your font"), "Roboto", FontWeight.w500, // FontStyle.italic); // add material icons, familyName must be "Material Icons" // FontManager.instance.addFont(Resources.Load<Font>(path: "path to material icons"), "Material Icons"); base.OnEnable(); }
emmm
下载字体放到Assets\Resources\Fonts
下
修改UI入口处
// UIMain.lua using System.Collections.Generic; using Unity.UIWidgets.engine; using Unity.UIWidgets.material; using Unity.UIWidgets.ui; using Unity.UIWidgets.widgets; using UnityEngine; namespace UI { public class UIMain : UIWidgetsPanel { protected override void OnEnable() { FontManager.instance.addFont(Resources.Load<Font>(path: "Fonts/MaterialIcons-Regular"), "Material Icons"); base.OnEnable(); } // ... } }
图标就可以正常显示了
来源:https://www.cnblogs.com/lunoctis/p/12238615.html