diff options
| author | dereelatwit <54997325+dereelatwit@users.noreply.github.com> | 2023-08-03 14:05:08 -0400 |
|---|---|---|
| committer | dereelatwit <54997325+dereelatwit@users.noreply.github.com> | 2023-08-03 14:05:08 -0400 |
| commit | b8aa2e0935f309b112648f0352f35f5f33da946b (patch) | |
| tree | 9121ae1a65e483dddba8367cbbdd4991abfb3e26 /Pathfinding Visualizer/Assets/TextMesh Pro/Examples & Extras/Scripts/SimpleScript.cs | |
| parent | 374125ba34e0366afb062578906877cfdf229bb9 (diff) | |
started implementing UI
Diffstat (limited to 'Pathfinding Visualizer/Assets/TextMesh Pro/Examples & Extras/Scripts/SimpleScript.cs')
| -rw-r--r-- | Pathfinding Visualizer/Assets/TextMesh Pro/Examples & Extras/Scripts/SimpleScript.cs | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/Pathfinding Visualizer/Assets/TextMesh Pro/Examples & Extras/Scripts/SimpleScript.cs b/Pathfinding Visualizer/Assets/TextMesh Pro/Examples & Extras/Scripts/SimpleScript.cs new file mode 100644 index 0000000..1c71c48 --- /dev/null +++ b/Pathfinding Visualizer/Assets/TextMesh Pro/Examples & Extras/Scripts/SimpleScript.cs @@ -0,0 +1,58 @@ +using UnityEngine; +using System.Collections; + + +namespace TMPro.Examples +{ + + public class SimpleScript : MonoBehaviour + { + + private TextMeshPro m_textMeshPro; + //private TMP_FontAsset m_FontAsset; + + private const string label = "The <#0050FF>count is: </color>{0:2}"; + private float m_frame; + + + void Start() + { + // Add new TextMesh Pro Component + m_textMeshPro = gameObject.AddComponent<TextMeshPro>(); + + m_textMeshPro.autoSizeTextContainer = true; + + // Load the Font Asset to be used. + //m_FontAsset = Resources.Load("Fonts & Materials/LiberationSans SDF", typeof(TMP_FontAsset)) as TMP_FontAsset; + //m_textMeshPro.font = m_FontAsset; + + // Assign Material to TextMesh Pro Component + //m_textMeshPro.fontSharedMaterial = Resources.Load("Fonts & Materials/LiberationSans SDF - Bevel", typeof(Material)) as Material; + //m_textMeshPro.fontSharedMaterial.EnableKeyword("BEVEL_ON"); + + // Set various font settings. + m_textMeshPro.fontSize = 48; + + m_textMeshPro.alignment = TextAlignmentOptions.Center; + + //m_textMeshPro.anchorDampening = true; // Has been deprecated but under consideration for re-implementation. + //m_textMeshPro.enableAutoSizing = true; + + //m_textMeshPro.characterSpacing = 0.2f; + //m_textMeshPro.wordSpacing = 0.1f; + + //m_textMeshPro.enableCulling = true; + m_textMeshPro.enableWordWrapping = false; + + //textMeshPro.fontColor = new Color32(255, 255, 255, 255); + } + + + void Update() + { + m_textMeshPro.SetText(label, m_frame % 1000); + m_frame += 1 * Time.deltaTime; + } + + } +} |
