Skip to content

Commit a4f85cb

Browse files
committed
feat: add support for TextMeshPro, including <font> and <sprite> tags
1 parent 1306e19 commit a4f85cb

22 files changed

+8195
-0
lines changed

Assets/Demos/TextMeshPro Support/CarterOne-Regular SDF.asset

+2,797
Large diffs are not rendered by default.

Assets/Demos/TextMeshPro Support/CarterOne-Regular SDF.asset.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

Assets/Demos/TextMeshPro Support/CarterOne-Regular.ttf.meta

+22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Loading

Assets/Demos/TextMeshPro Support/Floor Cement.jpg.meta

+53
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Loading

Assets/Demos/TextMeshPro Support/Fruit Jelly (B&W).jpg.meta

+53
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#if UNITY_EDITOR
2+
using System.Diagnostics;
3+
using System.Text;
4+
using UnityEditor;
5+
using UnityEngine;
6+
using Debug = UnityEngine.Debug;
7+
8+
internal static class ImportSample
9+
{
10+
[MenuItem("Development/Import TMP Support V1", false, 2001)]
11+
private static void ImportTMPSupportV1()
12+
{
13+
Run("TextMeshPro Support");
14+
}
15+
16+
[MenuItem("Development/Import TMP Support V2", false, 2002)]
17+
private static void ImportTMPSupportV2()
18+
{
19+
Run("TextMeshPro Support (Unity 6)");
20+
}
21+
22+
[InitializeOnLoadMethod]
23+
private static void ImportSampleOnLoad()
24+
{
25+
#if UNITY_2023_2_OR_NEWER
26+
ImportTMPSupportV2();
27+
#else
28+
ImportTMPSupportV1();
29+
#endif
30+
}
31+
32+
private static void Run(string sample)
33+
{
34+
var p = new Process()
35+
{
36+
StartInfo = new ProcessStartInfo()
37+
{
38+
Arguments = $"import-tmp-support.sh '{sample}'",
39+
CreateNoWindow = true,
40+
#if UNITY_EDITOR_WIN
41+
FileName = @"C:\Program Files (x86)\Git\bin\bash.exe",
42+
#else
43+
FileName = "/bin/bash",
44+
#endif
45+
RedirectStandardError = true,
46+
RedirectStandardOutput = true,
47+
WorkingDirectory = $"{Application.dataPath}/..",
48+
UseShellExecute = false
49+
},
50+
EnableRaisingEvents = true
51+
};
52+
53+
p.Exited += (_, __) =>
54+
{
55+
var result = new StringBuilder();
56+
var stdout = p.StandardOutput.ReadToEnd();
57+
result.Append("stdout: ");
58+
result.Append(stdout);
59+
result.AppendLine();
60+
result.Append("stderr: ");
61+
result.Append(p.StandardError.ReadToEnd());
62+
Debug.Log(result);
63+
64+
if (p.ExitCode == 0 && stdout.StartsWith("Imported: "))
65+
{
66+
var path = stdout.Replace("Imported: ", "").Trim();
67+
AssetDatabase.ImportAsset(path, ImportAssetOptions.ImportRecursive);
68+
}
69+
};
70+
71+
p.Start();
72+
}
73+
}
74+
#endif

Assets/Demos/TextMeshPro Support/ImportSample.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)