diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2020-04-19 17:19:32 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2020-04-19 17:19:32 -0400 |
| commit | c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78 (patch) | |
| tree | ee4d51c7c1d633e11f46453ef1edd3c77c4ef9f7 /Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleAssetMenu.cs | |
| download | Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.tar.gz Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.tar.bz2 Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.zip | |
Inital commit
Diffstat (limited to 'Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleAssetMenu.cs')
| -rw-r--r-- | Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleAssetMenu.cs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleAssetMenu.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleAssetMenu.cs new file mode 100644 index 0000000..db42bb4 --- /dev/null +++ b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_StyleAssetMenu.cs @@ -0,0 +1,49 @@ +using UnityEngine;
+using UnityEditor;
+using System.IO;
+using System.Collections;
+
+
+namespace TMPro.EditorUtilities
+{
+
+ public static class TMP_StyleAssetMenu
+ {
+
+ [MenuItem("Assets/Create/TextMeshPro/Style Sheet", false, 120)]
+ public static void CreateTextMeshProObjectPerform()
+ {
+ string filePath;
+ if (Selection.assetGUIDs.Length == 0)
+ {
+ // No asset selected.
+ filePath = "Assets";
+ }
+ else
+ {
+ // Get the path of the selected folder or asset.
+ filePath = AssetDatabase.GUIDToAssetPath(Selection.assetGUIDs[0]);
+
+ // Get the file extension of the selected asset as it might need to be removed.
+ string fileExtension = Path.GetExtension(filePath);
+ if (fileExtension != "")
+ {
+ filePath = Path.GetDirectoryName(filePath);
+ }
+ }
+
+
+ string filePathWithName = AssetDatabase.GenerateUniqueAssetPath(filePath + "/TMP StyleSheet.asset");
+
+ //// Create new Style Sheet Asset.
+ TMP_StyleSheet styleSheet = ScriptableObject.CreateInstance<TMP_StyleSheet>();
+
+ AssetDatabase.CreateAsset(styleSheet, filePathWithName);
+
+ EditorUtility.SetDirty(styleSheet);
+
+ AssetDatabase.SaveAssets();
+ }
+ }
+
+}
\ No newline at end of file |
