diff --git a/src/Resources/modern.bundle b/src/Resources/modern.bundle index c6acc12..b40c19f 100644 Binary files a/src/Resources/modern.bundle and b/src/Resources/modern.bundle differ diff --git a/src/UI/UIFactory.cs b/src/UI/UIFactory.cs index fc3e526..8b889c1 100644 --- a/src/UI/UIFactory.cs +++ b/src/UI/UIFactory.cs @@ -16,12 +16,6 @@ namespace UnityExplorer.UI internal static Vector2 _largeElementSize = new Vector2(100, 30); internal static Vector2 _smallElementSize = new Vector2(25, 25); internal static Color _defaultTextColor = Color.white; - internal static Font _defaultFont; - - public static void Init() - { - _defaultFont = Resources.GetBuiltinResource("Arial.ttf"); - } public static GameObject CreateUIObject(string name, GameObject parent, Vector2 size = default) { @@ -48,7 +42,7 @@ namespace UnityExplorer.UI internal static void SetDefaultTextValues(Text text) { text.color = _defaultTextColor; - text.font = _defaultFont; + text.font = UIManager.DefaultFont; text.fontSize = 14; } diff --git a/src/UI/UIManager.cs b/src/UI/UIManager.cs index 7877ed2..098d370 100644 --- a/src/UI/UIManager.cs +++ b/src/UI/UIManager.cs @@ -52,6 +52,7 @@ namespace UnityExplorer.UI internal static GameObject PanelHolder { get; private set; } internal static Font ConsoleFont { get; private set; } + internal static Font DefaultFont { get; private set; } internal static Shader BackupShader { get; private set; } public static RectTransform NavBarRect; @@ -92,8 +93,6 @@ namespace UnityExplorer.UI { LoadBundle(); - UIFactory.Init(); - CreateRootCanvas(); // Global UI Pool Holder @@ -423,11 +422,11 @@ namespace UnityExplorer.UI int minor = int.Parse(split[1]); // Use appropriate AssetBundle for Unity version - // >= 2017.3 - if (major > 2017 || (major == 2017 && minor >= 3)) + // >= 2017 + if (major >= 2017) bundle = LoadBundle("modern"); - // 5.6.0 to 2017.3 - else if (major == 2017 || (major == 5 && minor >= 6)) + // 5.6.0 to <2017 + else if (major == 5 && minor >= 6) bundle = LoadBundle("legacy.5.6"); // < 5.6.0 else @@ -452,11 +451,15 @@ namespace UnityExplorer.UI { ExplorerCore.LogWarning("Could not load the ExplorerUI Bundle!"); ConsoleFont = Resources.GetBuiltinResource("Arial.ttf"); + DefaultFont = ConsoleFont; return; } - BackupShader = bundle.LoadAsset("DefaultUI"); + // Bundle loaded + ConsoleFont = bundle.LoadAsset("CONSOLA"); + DefaultFont = bundle.LoadAsset("arial"); + BackupShader = bundle.LoadAsset("DefaultUI"); // Fix for games which don't ship with 'UI/Default' shader. if (Graphic.defaultGraphicMaterial.shader?.name != "UI/Default") { @@ -466,7 +469,6 @@ namespace UnityExplorer.UI else BackupShader = Graphic.defaultGraphicMaterial.shader; - ConsoleFont = bundle.LoadAsset("CONSOLA"); } private static byte[] ReadFully(Stream input)