暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TMP_ResourcesLoader.cs 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. using System.Collections;
  2. using UnityEditor;
  3. using UnityEngine;
  4. namespace TMPro.EditorUtilities
  5. {
  6. /*
  7. [InitializeOnLoad]
  8. class EssentialResourcesManager
  9. {
  10. private const string s_TMPShaderIncludeGUID = "407bc68d299748449bbf7f48ee690f8d";
  11. const string k_EssentialResourcesShaderVersionCheckKey = "TMP.EssentialResources.ShaderVersionCheck";
  12. static EssentialResourcesManager()
  13. {
  14. bool shaderSearched = SessionState.GetBool(k_EssentialResourcesShaderVersionCheckKey, false);
  15. if (!EditorApplication.isPlayingOrWillChangePlaymode && !shaderSearched)
  16. CheckShaderVersions();
  17. }
  18. static void CheckShaderVersions()
  19. {
  20. // Get path to TMP shader include file.
  21. string assetPath = AssetDatabase.GUIDToAssetPath(s_TMPShaderIncludeGUID);
  22. if (string.IsNullOrEmpty(assetPath))
  23. return;
  24. AssetImporter importer = AssetImporter.GetAtPath(assetPath);
  25. if (importer != null && string.IsNullOrEmpty(importer.userData))
  26. {
  27. // Show Shader Import Window
  28. TMP_EditorCoroutine.StartCoroutine(ShowShaderPackageImporterWindow());
  29. }
  30. SessionState.SetBool(k_EssentialResourcesShaderVersionCheckKey, true);
  31. }
  32. static IEnumerator ShowShaderPackageImporterWindow()
  33. {
  34. yield return new WaitForSeconds(5.0f);
  35. TMP_ShaderPackageImporterWindow.ShowPackageImporterWindow();
  36. }
  37. }
  38. */
  39. /*
  40. //[InitializeOnLoad]
  41. class TMP_ResourcesLoader
  42. {
  43. /// <summary>
  44. /// Function to pre-load the TMP Resources
  45. /// </summary>
  46. public static void LoadTextMeshProResources()
  47. {
  48. //TMP_Settings.LoadDefaultSettings();
  49. //TMP_StyleSheet.LoadDefaultStyleSheet();
  50. }
  51. static TMP_ResourcesLoader()
  52. {
  53. //Debug.Log("Loading TMP Resources...");
  54. // Get current targetted platform
  55. //string Settings = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
  56. //TMPro.TMP_Settings.LoadDefaultSettings();
  57. //TMPro.TMP_StyleSheet.LoadDefaultStyleSheet();
  58. }
  59. //[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
  60. //static void OnBeforeSceneLoaded()
  61. //{
  62. //Debug.Log("Before scene is loaded.");
  63. // //TMPro.TMP_Settings.LoadDefaultSettings();
  64. // //TMPro.TMP_StyleSheet.LoadDefaultStyleSheet();
  65. // //ShaderVariantCollection collection = new ShaderVariantCollection();
  66. // //Shader s0 = Shader.Find("TextMeshPro/Mobile/Distance Field");
  67. // //ShaderVariantCollection.ShaderVariant tmp_Variant = new ShaderVariantCollection.ShaderVariant(s0, UnityEngine.Rendering.PassType.Normal, string.Empty);
  68. // //collection.Add(tmp_Variant);
  69. // //collection.WarmUp();
  70. //}
  71. }
  72. //static class TMP_ProjectSettings
  73. //{
  74. // [InitializeOnLoadMethod]
  75. // static void SetProjectDefineSymbols()
  76. // {
  77. // string currentBuildSettings = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
  78. // //Check for and inject TMP_INSTALLED
  79. // if (!currentBuildSettings.Contains("TMP_PRESENT"))
  80. // {
  81. // PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, currentBuildSettings + ";TMP_PRESENT");
  82. // }
  83. // }
  84. //}
  85. */
  86. }