File tree Expand file tree Collapse file tree
BeatSaberMarkupLanguage/Harmony Patches Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- using System . Linq ;
1+ using System . Collections . Generic ;
2+ using System . Linq ;
3+ using System . Reflection ;
24using HarmonyLib ;
35using TMPro ;
46using UnityEngine ;
@@ -21,14 +23,20 @@ public static bool Prefix(ref Shader __result)
2123 }
2224 }
2325
24- [ HarmonyPatch ( typeof ( TMP_Settings ) , nameof ( TMP_Settings . instance ) , MethodType . Getter ) ]
25- internal static class TMP_Settings_GetFontAsset
26+ [ HarmonyPatch ]
27+ internal static class TextMeshPro_LoadFontAsset
2628 {
27- public static void Postfix ( )
29+ public static IEnumerable < MethodBase > TargetMethods ( )
2830 {
29- if ( TMP_Settings . s_Instance . m_defaultFontAsset == null )
31+ yield return AccessTools . DeclaredMethod ( typeof ( TextMeshPro ) , "LoadFontAsset" ) ;
32+ yield return AccessTools . DeclaredMethod ( typeof ( TextMeshProUGUI ) , "LoadFontAsset" ) ;
33+ }
34+
35+ public static void Prefix ( TMP_Text __instance )
36+ {
37+ if ( __instance . font == null )
3038 {
31- TMP_Settings . s_Instance . m_defaultFontAsset = Resources . FindObjectsOfTypeAll < TMP_FontAsset > ( ) . FirstOrDefault ( f => f . name == "Teko-Medium SDF" ) ;
39+ __instance . font = BeatSaberUI . MainTextFont ;
3240 }
3341 }
3442 }
You can’t perform that action at this time.
0 commit comments