Reimport upgraded TextMesh Pro, modified.
This commit is contained in:
@@ -1,21 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TextCore.Text;
|
||||
using IFont = UnityEngine.Font;
|
||||
|
||||
namespace Cryville.Common.Unity.UI {
|
||||
[RequireComponent(typeof(TextMeshProUGUI))]
|
||||
public class TMPAutoFont : MonoBehaviour {
|
||||
public static Shader DefaultShader;
|
||||
public static readonly List<string> Fonts = new List<string> {
|
||||
"Arial",
|
||||
};
|
||||
static TMP_FontAsset _font;
|
||||
static FontAsset _font;
|
||||
TextMeshProUGUI _text;
|
||||
|
||||
[SerializeField]
|
||||
Shader m_shader;
|
||||
void Awake() {
|
||||
_text = GetComponent<TextMeshProUGUI>();
|
||||
if (_font == null) {
|
||||
var _ifont = new IFont("C:/Windows/Fonts/arial.ttf");
|
||||
_font = TMP_FontAsset.CreateFontAsset(_ifont);
|
||||
_font = FontAsset.CreateFontAsset(_ifont);
|
||||
if (m_shader) _font.material.shader = m_shader;
|
||||
else if (DefaultShader) _font.material.shader = DefaultShader;
|
||||
}
|
||||
_text.font = _font;
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
executionOrder: -120
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
|
Reference in New Issue
Block a user