Last active
February 2, 2019 16:48
-
-
Save tsubaki/acd0cbc7a56ce74716fe052f526bec3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
// for Text Mesh Pro 1.4 previewで | |
// フォントが一杯になると使えなくなる問題の場当たり的対処法 | |
// (多分将来的に不要になる) | |
public class UpdateText : MonoBehaviour | |
{ | |
TMPro.TextMeshProUGUI label; | |
private void Awake() | |
{ | |
label = GetComponent<TMPro.TextMeshProUGUI>(); | |
} | |
public void SetText(string str) | |
{ | |
if (!label.font.TryAddCharacters(str)) | |
{ | |
label.font.ClearFontAssetData(); | |
label.font.TryAddCharacters(str); | |
} | |
label.text = str; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment