protected override void PreprocessComponent(Component comp) { UILabel label = comp as UILabel; UIFont font = label.bitmapFont; if (font == null) { return; } if (isCdnAsset) { if (font.replacement != null) { // get singleton prefab GameObject singleton = AssetDatabase.LoadAssetAtPath <GameObject>("Assets/Reskin/singletons.prefab"); FontLoader loader = singleton.GetComponentEx <FontLoader>(); AddFont(loader, font); label.bitmapFont = null; BuildScript.SetDirty(label); } // add font marker to restore FontMarker marker = label.GetComponentEx <FontMarker>(); marker.label = label; marker.fontName = font.name; BuildScript.SetDirty(marker); } }
public static void ApplyFont(FontMarker marker) { if (marker.label.bitmapFont != null) { return; } marker.label.bitmapFont = fontsLoaded.Get(marker.fontName); }