diff --git a/CHANGELOG.md b/CHANGELOG.md index eb2a1c2..f26decc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,23 @@ # Changelog These are the release notes for the TextMesh Pro UPM package which was first introduced with Unity 2018.1. Please see the following link for the Release Notes for prior versions of TextMesh Pro. http://digitalnativestudios.com/forum/index.php?topic=1363.0 -## [1.3.0] - 2018-05-30 +## [1.3.0] - 2018-08-09 ### Changes - Revamped UI to conform to Unity Human Interface Guidelines. +- Updated the title text on the Font Asset Creator window tab to "Font Asset Creator". +- Using TMP_Text.SetCharArray() with an empty char[] array will now clear the text. +- Made a small improvement to the TMP Input Field when using nested 2d RectMasks. +- Renamed symbol defines used by TMP to append TMP_ in front of the define to avoid potential conflicts with user defines. +- Improved the Project Files GUID Remapping tool to allow specifying a target folder to scan. +- Added the ability to cancel the scanning process used by the Project Files GUID Remapping tool. +- Moved TMP Settings to universal settings window in 2018.3 and above. +- Changing style sheet in the TMP Settings will now be reflected automatically on existing text objects in the editor. +- Added new function TMP_StyleSheet.UpdateStyleSheet() to update the internal reference to which style sheet text objects should be using in conjunction with the style tag. + +## [1.2.4] - 2018-06-10 +### Changes +- Fixed a minor issue when using Justified and Flush alignment in conjunction with \u00A0. +- The Font Asset creationSettings field is no longer an Editor only serialized field. ## [1.2.3] - 2018-05-29 ### Changes diff --git a/Scripts/Editor/TMP_PackageUtilities.cs b/Scripts/Editor/TMP_PackageUtilities.cs index 69b5aa0..da773e1 100644 --- a/Scripts/Editor/TMP_PackageUtilities.cs +++ b/Scripts/Editor/TMP_PackageUtilities.cs @@ -52,13 +52,16 @@ struct AssetModificationRecord public string assetDataFile; } + private static string m_ProjectFolderToScan; private static bool m_IsAlreadyScanningProject; + private static bool m_CancelScanProcess; private static string k_ProjectScanReportDefaultText = "Project Scan Results\n"; private static string m_ProjectScanResults = string.Empty; private static Vector2 m_ProjectScanResultScrollPosition; private static float m_ProgressPercentage = 0; private static int m_ScanningTotalFiles; private static int m_ScanningCurrentFileIndex; + private static string m_ScanningCurrentFileName; private static List m_ModifiedAssetList = new List(); @@ -79,12 +82,17 @@ void OnGUI() GUILayout.BeginVertical(EditorStyles.helpBox); { GUILayout.Label("Scan Project Files", EditorStyles.boldLabel); - GUILayout.Label("Press the Scan Project Files button to begin scanning your project for files & resources that were created with a previous version of TextMesh Pro", TMP_UIStyleManager.label); + GUILayout.Label("Press the Scan Project Files button to begin scanning your project for files & resources that were created with a previous version of TextMesh Pro.", TMP_UIStyleManager.label); + GUILayout.Space(10f); + GUILayout.Label("Project folder to be scanned. Example \"Assets/TextMesh Pro\""); + m_ProjectFolderToScan = EditorGUILayout.TextField("Folder Path: Assets/", m_ProjectFolderToScan); GUILayout.Space(5f); GUI.enabled = m_IsAlreadyScanningProject == false ? true : false; if (GUILayout.Button("Scan Project Files")) { + m_CancelScanProcess = false; + // Make sure Asset Serialization mode is set to ForceText and Version Control mode to Visible Meta Files. if (CheckProjectSerializationAndSourceControlModes() == true) { @@ -100,6 +108,20 @@ void OnGUI() // Display progress bar Rect rect = GUILayoutUtility.GetRect(0f, 20f, GUILayout.ExpandWidth(true)); EditorGUI.ProgressBar(rect, m_ProgressPercentage, "Scan Progress (" + m_ScanningCurrentFileIndex + "/" + m_ScanningTotalFiles + ")"); + + // Display cancel button and name of file currently being scanned. + if (m_IsAlreadyScanningProject) + { + Rect cancelRect = new Rect(rect.width - 20, rect.y + 2, 20, 16); + if (GUI.Button(cancelRect, "X")) + { + m_CancelScanProcess = true; + } + GUILayout.Label("Scanning: " + m_ScanningCurrentFileName); + } + else + GUILayout.Label(string.Empty); + GUILayout.Space(5); // Creation Feedback @@ -170,25 +192,46 @@ private IEnumerator ScanProjectFiles() AssetConversionData conversionData_Assets = JsonUtility.FromJson(File.ReadAllText(packageFullPath + "/PackageConversionData_Assets.json")); // Get list of GUIDs for assets that might contain references to previous GUIDs that require updating. - string[] projectGUIDs = AssetDatabase.FindAssets("t:Object"); + string searchFolder = string.IsNullOrEmpty(m_ProjectFolderToScan) ? "Assets" : ("Assets/" + m_ProjectFolderToScan); + string[] projectGUIDs = AssetDatabase.FindAssets("t:Object", new string[] { searchFolder }); m_ScanningTotalFiles = projectGUIDs.Length; + bool cancelScanning = false; + // Iterate through projectGUIDs to search project assets of the types likely to reference GUIDs and FileIDs used by previous versions of TextMesh Pro. - for (int i = 0; i < projectGUIDs.Length; i++) + for (int i = 0; i < projectGUIDs.Length && cancelScanning == false; i++) { + if (m_CancelScanProcess) + { + cancelScanning = true; + ResetScanProcess(); + + continue; + } + m_ScanningCurrentFileIndex = i + 1; string guid = projectGUIDs[i]; string assetFilePath = AssetDatabase.GUIDToAssetPath(guid); + string assetFileExtension = Path.GetExtension(assetFilePath); System.Type assetType = AssetDatabase.GetMainAssetTypeAtPath(assetFilePath); // Filter out asset types that we can't read or have not interest in searching. - if (assetType == typeof(DefaultAsset) || assetType == typeof(MonoScript) || assetType == typeof(Texture2D) || + if (assetType == typeof(DefaultAsset) || assetType == typeof(MonoScript) || assetType == typeof(Texture2D) || assetType == typeof(Texture3D) || assetType == typeof(Cubemap) || assetType == typeof(TextAsset) || assetType == typeof(Shader) || assetType == typeof(Font) || assetType == typeof(UnityEditorInternal.AssemblyDefinitionAsset) || - assetType == typeof(GUISkin) || assetType == typeof(PhysicsMaterial2D) || assetType == typeof(UnityEngine.U2D.SpriteAtlas) || assetType == typeof(UnityEngine.Tilemaps.Tile) || - assetType == typeof(AudioClip) || assetType == typeof(ComputeShader) || assetType == typeof(UnityEditor.Animations.AnimatorController)) + assetType == typeof(GUISkin) || assetType == typeof(PhysicsMaterial2D) || assetType == typeof(PhysicMaterial) || assetType == typeof(UnityEngine.U2D.SpriteAtlas) || assetType == typeof(UnityEngine.Tilemaps.Tile) || + assetType == typeof(AudioClip) || assetType == typeof(ComputeShader) || assetType == typeof(UnityEditor.Animations.AnimatorController) || assetType == typeof(UnityEngine.AI.NavMeshData) || + assetType == typeof(Mesh) || assetType == typeof(RenderTexture) || assetType == typeof(Texture2DArray) || assetType == typeof(LightingDataAsset) || assetType == typeof(AvatarMask) || + assetType == typeof(AnimatorOverrideController) || assetType == typeof(TerrainData) || assetType == typeof(HumanTemplate) || assetType == typeof(Flare) || assetType == typeof(UnityEngine.Video.VideoClip)) + continue; + + // Exclude FBX + if (assetType == typeof(GameObject) && (assetFileExtension == ".FBX" || assetFileExtension == ".fbx")) continue; + m_ScanningCurrentFileName = assetFilePath; + //Debug.Log("Searching Asset: [" + assetFilePath + "] with file extension [" + assetFileExtension + "] of type [" + assetType + "]"); + // Read the asset data file string assetDataFile = string.Empty; try @@ -201,8 +244,6 @@ private IEnumerator ScanProjectFiles() continue; } - //Debug.Log("Searching Asset: [" + assetFilePath + "] of type: " + assetType); - bool hasFileChanged = false; // Special handling / optimization if assetType is null @@ -255,8 +296,16 @@ private IEnumerator ScanProjectFiles() } // Iterate through projectGUIDs (again) to search project meta files which reference GUIDs used by previous versions of TextMesh Pro. - for (int i = 0; i < projectGUIDs.Length; i++) + for (int i = 0; i < projectGUIDs.Length && cancelScanning == false; i++) { + if (m_CancelScanProcess) + { + cancelScanning = true; + ResetScanProcess(); + + continue; + } + string guid = projectGUIDs[i]; string assetFilePath = AssetDatabase.GUIDToAssetPath(guid); string assetMetaFilePath = AssetDatabase.GetTextMetaFilePathFromAssetPath(assetFilePath); @@ -266,6 +315,8 @@ private IEnumerator ScanProjectFiles() bool hasFileChanged = false; + m_ScanningCurrentFileName = assetMetaFilePath; + foreach (AssetConversionRecord record in conversionData.assetRecords) { if (assetMetaFile.Contains(record.target)) @@ -298,6 +349,20 @@ private IEnumerator ScanProjectFiles() } m_IsAlreadyScanningProject = false; + m_ScanningCurrentFileName = string.Empty; + } + + + /// + /// + /// + private static void ResetScanProcess() + { + m_IsAlreadyScanningProject = false; + m_ScanningCurrentFileName = string.Empty; + m_ProgressPercentage = 0; + m_ScanningCurrentFileIndex = 0; + m_ScanningTotalFiles = 0; } diff --git a/Scripts/Editor/TMP_ProjectTextSettings.cs b/Scripts/Editor/TMP_ProjectTextSettings.cs index 5b62d2c..b8695be 100644 --- a/Scripts/Editor/TMP_ProjectTextSettings.cs +++ b/Scripts/Editor/TMP_ProjectTextSettings.cs @@ -1,9 +1,6 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; +#if !UNITY_2018_3_OR_NEWER using UnityEditor; - namespace TMPro { @@ -43,3 +40,4 @@ static void ON_RESOURCES_LOADED() } } } +#endif \ No newline at end of file diff --git a/Scripts/Editor/TMP_SettingsEditor.cs b/Scripts/Editor/TMP_SettingsEditor.cs index 6367258..363c9bb 100644 --- a/Scripts/Editor/TMP_SettingsEditor.cs +++ b/Scripts/Editor/TMP_SettingsEditor.cs @@ -9,10 +9,8 @@ namespace TMPro.EditorUtilities [CustomEditor(typeof(TMP_Settings))] public class TMP_SettingsEditor : Editor { - static class Styles + class Styles { - static Styles() { } - public static readonly GUIContent defaultFontAssetLabel = new GUIContent("Default Font Asset", "The Font Asset that will be assigned by default to newly created text objects when no Font Asset is specified."); public static readonly GUIContent defaultFontAssetPathLabel = new GUIContent("Path: Resources/", "The relative path to a Resources folder where the Font Assets and Material Presets are located.\nExample \"Fonts & Materials/\""); @@ -88,6 +86,9 @@ static Styles() { } public void OnEnable() { + if (target == null) + return; + m_PropFontAsset = serializedObject.FindProperty("m_defaultFontAsset"); m_PropDefaultFontAssetPath = serializedObject.FindProperty("m_defaultFontAssetPath"); m_PropDefaultFontSize = serializedObject.FindProperty("m_defaultFontSize"); @@ -109,7 +110,7 @@ public void OnEnable() { var element = m_List.serializedProperty.GetArrayElementAtIndex(index); rect.y += 2; - EditorGUI.PropertyField( new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), element, GUIContent.none); + EditorGUI.PropertyField(new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), element, GUIContent.none); }; m_List.drawHeaderCallback = rect => @@ -136,6 +137,9 @@ public override void OnInspectorGUI() { serializedObject.Update(); + float labelWidth = EditorGUIUtility.labelWidth; + float fieldWidth = EditorGUIUtility.fieldWidth; + // TextMeshPro Font Info Panel EditorGUI.indentLevel = 0; @@ -203,8 +207,8 @@ public override void OnInspectorGUI() } EditorGUILayout.EndHorizontal(); - EditorGUIUtility.labelWidth = 0; - EditorGUIUtility.fieldWidth = 0; + EditorGUIUtility.labelWidth = labelWidth; + EditorGUIUtility.fieldWidth = fieldWidth; EditorGUILayout.PropertyField(m_PropWordWrapping, Styles.wordWrappingLabel); EditorGUILayout.PropertyField(m_PropKerning, Styles.kerningLabel); @@ -214,7 +218,6 @@ public override void OnInspectorGUI() EditorGUILayout.PropertyField(m_PropParseEscapeCharacters, Styles.parseEscapeCharactersLabel); - EditorGUIUtility.labelWidth = 0; EditorGUI.indentLevel = 0; EditorGUILayout.Space(); @@ -236,7 +239,13 @@ public override void OnInspectorGUI() EditorGUILayout.BeginVertical(EditorStyles.helpBox); GUILayout.Label(Styles.defaultStyleSheetLabel, EditorStyles.boldLabel); EditorGUI.indentLevel = 1; + EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(m_PropStyleSheet, Styles.defaultStyleSheetLabel); + if (EditorGUI.EndChangeCheck()) + { + serializedObject.ApplyModifiedProperties(); + TMP_StyleSheet.UpdateStyleSheet(); + } EditorGUI.indentLevel = 0; EditorGUILayout.Space(); @@ -270,5 +279,15 @@ public override void OnInspectorGUI() } } + + #if UNITY_2018_3_OR_NEWER + [SettingsProvider] + static SettingsProvider CreateTMPSettingsProvider() + { + var provider = new AssetSettingsProvider("Project/TextMesh Pro", () => TMP_Settings.instance); + provider.PopulateSearchKeywordsFromGUIContentProperties(); + return provider; + } + #endif } } \ No newline at end of file diff --git a/Scripts/Editor/TMPro_ContextMenus.cs b/Scripts/Editor/TMPro_ContextMenus.cs index c8e3ccd..c2862f1 100644 --- a/Scripts/Editor/TMPro_ContextMenus.cs +++ b/Scripts/Editor/TMPro_ContextMenus.cs @@ -166,35 +166,42 @@ static void ResetSettings(MenuCommand command) mat = Selection.activeGameObject.GetComponent().GetMaterial(); } - - //Material mat = (Material)command.context; Undo.RecordObject(mat, "Reset Material"); - Material tmp_mat = new Material(mat.shader); - ShaderUtilities.GetShaderPropertyIDs(); // Make sure we have valid Property IDs if (mat.HasProperty(ShaderUtilities.ID_GradientScale)) { - // Copy unique properties of the SDF Material over to the temp material. - tmp_mat.SetTexture(ShaderUtilities.ID_MainTex, mat.GetTexture(ShaderUtilities.ID_MainTex)); - tmp_mat.SetFloat(ShaderUtilities.ID_GradientScale, mat.GetFloat(ShaderUtilities.ID_GradientScale)); - tmp_mat.SetFloat(ShaderUtilities.ID_TextureWidth, mat.GetFloat(ShaderUtilities.ID_TextureWidth)); - tmp_mat.SetFloat(ShaderUtilities.ID_TextureHeight, mat.GetFloat(ShaderUtilities.ID_TextureHeight)); - tmp_mat.SetFloat(ShaderUtilities.ID_StencilID, mat.GetFloat(ShaderUtilities.ID_StencilID)); - tmp_mat.SetFloat(ShaderUtilities.ID_StencilComp, mat.GetFloat(ShaderUtilities.ID_StencilComp)); - - mat.CopyPropertiesFromMaterial(tmp_mat); + // Copy unique properties of the SDF Material + var texture = mat.GetTexture(ShaderUtilities.ID_MainTex); + var gradientScale = mat.GetFloat(ShaderUtilities.ID_GradientScale); + var texWidth = mat.GetFloat(ShaderUtilities.ID_TextureWidth); + var texHeight = mat.GetFloat(ShaderUtilities.ID_TextureHeight); + var stencilId = mat.GetFloat(ShaderUtilities.ID_StencilID); + var stencilComp = mat.GetFloat(ShaderUtilities.ID_StencilComp); + var normalWeight = mat.GetFloat(ShaderUtilities.ID_WeightNormal); + var boldWeight = mat.GetFloat(ShaderUtilities.ID_WeightBold); + + // Reset the material + Unsupported.SmartReset(mat); // Reset ShaderKeywords mat.shaderKeywords = new string[0]; // { "BEVEL_OFF", "GLOW_OFF", "UNDERLAY_OFF" }; + + // Copy unique material properties back to the material. + mat.SetTexture(ShaderUtilities.ID_MainTex, texture); + mat.SetFloat(ShaderUtilities.ID_GradientScale, gradientScale); + mat.SetFloat(ShaderUtilities.ID_TextureWidth, texWidth); + mat.SetFloat(ShaderUtilities.ID_TextureHeight, texHeight); + mat.SetFloat(ShaderUtilities.ID_StencilID, stencilId); + mat.SetFloat(ShaderUtilities.ID_StencilComp, stencilComp); + mat.SetFloat(ShaderUtilities.ID_WeightNormal, normalWeight); + mat.SetFloat(ShaderUtilities.ID_WeightBold, boldWeight); } else { - mat.CopyPropertiesFromMaterial(tmp_mat); + Unsupported.SmartReset(mat); } - DestroyImmediate(tmp_mat); - TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, mat); } diff --git a/Scripts/Editor/TMPro_FontAssetCreatorWindow.cs b/Scripts/Editor/TMPro_FontAssetCreatorWindow.cs index c2bd0a9..d2dd024 100644 --- a/Scripts/Editor/TMPro_FontAssetCreatorWindow.cs +++ b/Scripts/Editor/TMPro_FontAssetCreatorWindow.cs @@ -15,7 +15,7 @@ public class TMPro_FontAssetCreatorWindow : EditorWindow public static void ShowFontAtlasCreatorWindow() { var window = GetWindow(); - window.titleContent = new GUIContent("Font Creator"); + window.titleContent = new GUIContent("Font Asset Creator"); window.Focus(); // Make sure TMP Essential Resources have been imported. @@ -27,7 +27,7 @@ public static void ShowFontAtlasCreatorWindow(Font sourceFontFile) { var window = GetWindow(); - window.titleContent = new GUIContent("Font Creator"); + window.titleContent = new GUIContent("Font Asset Creator"); window.Focus(); // Override selected font asset diff --git a/Scripts/Runtime/PackageResourceImporterWindow.cs b/Scripts/Runtime/PackageResourceImporterWindow.cs index 1c037b8..541a2c1 100644 --- a/Scripts/Runtime/PackageResourceImporterWindow.cs +++ b/Scripts/Runtime/PackageResourceImporterWindow.cs @@ -135,6 +135,10 @@ void ImportCallback(string packageName) { k_EssentialResourcesImported = true; TMPro_EventManager.ON_RESOURCES_LOADED(); + + #if UNITY_2018_3_OR_NEWER + SettingsService.NotifySettingsProviderChanged(); + #endif } else if (packageName == "TMP Examples & Extras") { diff --git a/Scripts/Runtime/TMP_FontAsset.cs b/Scripts/Runtime/TMP_FontAsset.cs index 52d2e15..42ffdfc 100644 --- a/Scripts/Runtime/TMP_FontAsset.cs +++ b/Scripts/Runtime/TMP_FontAsset.cs @@ -19,7 +19,6 @@ public struct TMP_FontWeights } - [Serializable] public class TMP_FontAsset : TMP_Asset { @@ -58,7 +57,6 @@ public FaceInfo fontInfo // Glyph Info - [SerializeField] private List m_glyphInfoList; @@ -74,7 +72,6 @@ public Dictionary characterDictionary } private Dictionary m_characterDictionary; - /// /// Dictionary containing the kerning data /// @@ -99,14 +96,12 @@ public KerningTable kerningInfo #pragma warning disable 0169 // Property is used to create an empty Kerning Pair in the editor. private KerningPair m_kerningPair; // Used for creating a new kerning pair in Editor Panel. - /// /// List containing the Fallback font assets for this font. /// [SerializeField] public List fallbackFontAssets; - #if UNITY_EDITOR /// /// The settings used in the Font Asset Creator when this font asset was created or edited. /// @@ -117,7 +112,6 @@ public FontAssetCreationSettings creationSettings } [SerializeField] public FontAssetCreationSettings m_CreationSettings; - #endif // FONT WEIGHTS [SerializeField] diff --git a/Scripts/Runtime/TMP_InputField.cs b/Scripts/Runtime/TMP_InputField.cs index 011cec6..8a42a6e 100644 --- a/Scripts/Runtime/TMP_InputField.cs +++ b/Scripts/Runtime/TMP_InputField.cs @@ -791,19 +791,15 @@ protected override void OnEnable() { m_TextComponent.RegisterDirtyVerticesCallback(MarkGeometryAsDirty); m_TextComponent.RegisterDirtyVerticesCallback(UpdateLabel); - m_TextComponent.ignoreRectMaskCulling = true; + //m_TextComponent.ignoreRectMaskCulling = multiLine; m_DefaultTransformPosition = m_TextComponent.rectTransform.localPosition; // Cache reference to Vertical Scrollbar RectTransform and add listener. if (m_VerticalScrollbar != null) { + m_TextComponent.ignoreRectMaskCulling = true; m_VerticalScrollbar.onValueChanged.AddListener(OnScrollbarValueChange); - //m_VerticalScrollbar.onSelect.AddListener(SetTextScrollPosition); - - //if (m_VerticalScrollbarEventHandler == null) - // m_VerticalScrollbarEventHandler = m_VerticalScrollbar.gameObject.AddComponent(); - } UpdateLabel(); @@ -2656,8 +2652,13 @@ public void ForceLabelUpdate() private void MarkGeometryAsDirty() { #if UNITY_EDITOR + #if UNITY_2018_3_OR_NEWER + if (!Application.isPlaying || UnityEditor.PrefabUtility.IsPartOfPrefabAsset(this)) + return; + #else if (!Application.isPlaying || UnityEditor.PrefabUtility.GetPrefabObject(gameObject) != null) return; + #endif #endif CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(this); diff --git a/Scripts/Runtime/TMP_MaterialManager.cs b/Scripts/Runtime/TMP_MaterialManager.cs index e953498..062f6e8 100644 --- a/Scripts/Runtime/TMP_MaterialManager.cs +++ b/Scripts/Runtime/TMP_MaterialManager.cs @@ -1,4 +1,4 @@ -//#define DEBUG_ON +//#define TMP_DEBUG_MODE using UnityEngine; using System.Collections.Generic; @@ -70,7 +70,7 @@ public static Material GetStencilMaterial(Material baseMaterial, int stencilID) { m_materialList[i].count += 1; - #if DEBUG_ON + #if TMP_DEBUG_MODE ListMaterials(); #endif @@ -108,7 +108,7 @@ public static Material GetStencilMaterial(Material baseMaterial, int stencilID) m_materialList.Add(temp); - #if DEBUG_ON + #if TMP_DEBUG_MODE ListMaterials(); #endif @@ -142,7 +142,7 @@ public static void ReleaseStencilMaterial(Material stencilMaterial) } - #if DEBUG_ON + #if TMP_DEBUG_MODE ListMaterials(); #endif } @@ -215,7 +215,7 @@ public static void RemoveStencilMaterial(Material stencilMaterial) m_materialList.RemoveAt(index); } - #if DEBUG_ON + #if TMP_DEBUG_MODE ListMaterials(); #endif } @@ -246,7 +246,7 @@ public static void ReleaseBaseMaterial(Material baseMaterial) } } - #if DEBUG_ON + #if TMP_DEBUG_MODE ListMaterials(); #endif } @@ -407,8 +407,8 @@ public static Material GetFallbackMaterial (Material sourceMaterial, Material ta m_fallbackMaterials.Add(key, fallback); m_fallbackMaterialLookup.Add(fallbackMaterial.GetInstanceID(), key); - #if DEBUG_ON - ListFallbackMaterials(); + #if TMP_DEBUG_MODE + ListFallbackMaterials(); #endif return fallbackMaterial; @@ -520,8 +520,8 @@ public static void ReleaseFallbackMaterial(Material fallackMaterial) isFallbackListDirty = true; - #if DEBUG_ON - ListFallbackMaterials(); + #if TMP_DEBUG_MODE + ListFallbackMaterials(); #endif } @@ -579,7 +579,7 @@ public static void CopyMaterialPresetProperties(Material source, Material destin } -#if DEBUG_ON + #if TMP_DEBUG_MODE /// /// /// @@ -626,7 +626,7 @@ public static void ListFallbackMaterials() Debug.Log("Item #" + (i + 1) + " - Base Material is [" + baseMaterial.name + "] with ID " + baseMaterial.GetInstanceID() + " is associated with [" + (fallbackMaterial != null ? fallbackMaterial.name : "Null") + "] with ID " + (fallbackMaterial != null ? fallbackMaterial.GetInstanceID() : 0) + " and is referenced " + m_fallbackMaterialList[i].count + " time(s)."); } } -#endif + #endif } } diff --git a/Scripts/Runtime/TMP_Settings.cs b/Scripts/Runtime/TMP_Settings.cs index b6929f6..651dd93 100644 --- a/Scripts/Runtime/TMP_Settings.cs +++ b/Scripts/Runtime/TMP_Settings.cs @@ -18,7 +18,7 @@ public class TMP_Settings : ScriptableObject /// public static string version { - get { return "1.2.3"; } + get { return "1.3.0"; } } /// diff --git a/Scripts/Runtime/TMP_StyleSheet.cs b/Scripts/Runtime/TMP_StyleSheet.cs index e91a81c..c7eb540 100644 --- a/Scripts/Runtime/TMP_StyleSheet.cs +++ b/Scripts/Runtime/TMP_StyleSheet.cs @@ -79,7 +79,6 @@ private TMP_Style GetStyleInternal(int hashCode) } - public void UpdateStyleDictionaryKey(int old_key, int new_key) { if (m_StyleDictionary.ContainsKey(old_key)) @@ -91,6 +90,18 @@ public void UpdateStyleDictionaryKey(int old_key, int new_key) } + /// + /// Function to update the internal reference to a newly assigned style sheet in the TMP Settings. + /// + public static void UpdateStyleSheet() + { + // Reset instance + s_Instance = null; + + RefreshStyles(); + } + + /// /// Function to refresh the Style Dictionary. /// diff --git a/Scripts/Runtime/TMP_SubMesh.cs b/Scripts/Runtime/TMP_SubMesh.cs index bec4cf5..7dae553 100644 --- a/Scripts/Runtime/TMP_SubMesh.cs +++ b/Scripts/Runtime/TMP_SubMesh.cs @@ -181,26 +181,26 @@ public Mesh mesh /// /// /// - public BoxCollider boxCollider - { - get - { - if (m_boxCollider == null) - { - // - m_boxCollider = GetComponent(); - if (m_boxCollider == null) - { - m_boxCollider = gameObject.AddComponent(); - gameObject.AddComponent(); - } - } - - return m_boxCollider; - } - } - [SerializeField] - private BoxCollider m_boxCollider; + //public BoxCollider boxCollider + //{ + // get + // { + // if (m_boxCollider == null) + // { + // // + // m_boxCollider = GetComponent(); + // if (m_boxCollider == null) + // { + // m_boxCollider = gameObject.AddComponent(); + // gameObject.AddComponent(); + // } + // } + + // return m_boxCollider; + // } + //} + //[SerializeField] + //private BoxCollider m_boxCollider; [SerializeField] private TextMeshPro m_TextComponent; @@ -555,28 +555,27 @@ protected void UpdateMaterial() /// /// /// - public void UpdateColliders(int vertexCount) - { - if (this.boxCollider == null) return; - - Vector2 bl = TMP_Math.MAX_16BIT; - Vector2 tr = TMP_Math.MIN_16BIT; - // Compute the bounds of the sub text object mesh (excluding the transform position). - for (int i = 0; i < vertexCount; i++) - { - bl.x = Mathf.Min(bl.x, m_mesh.vertices[i].x); - bl.y = Mathf.Min(bl.y, m_mesh.vertices[i].y); - - tr.x = Mathf.Max(tr.x, m_mesh.vertices[i].x); - tr.y = Mathf.Max(tr.y, m_mesh.vertices[i].y); - } - - Vector3 center = (bl + tr) / 2; - Vector3 size = tr - bl; - size.z = .1f; - this.boxCollider.center = center; - this.boxCollider.size = size; - - } + //public void UpdateColliders(int vertexCount) + //{ + // if (this.boxCollider == null) return; + + // Vector2 bl = TMP_Math.MAX_16BIT; + // Vector2 tr = TMP_Math.MIN_16BIT; + // // Compute the bounds of the sub text object mesh (excluding the transform position). + // for (int i = 0; i < vertexCount; i++) + // { + // bl.x = Mathf.Min(bl.x, m_mesh.vertices[i].x); + // bl.y = Mathf.Min(bl.y, m_mesh.vertices[i].y); + + // tr.x = Mathf.Max(tr.x, m_mesh.vertices[i].x); + // tr.y = Mathf.Max(tr.y, m_mesh.vertices[i].y); + // } + + // Vector3 center = (bl + tr) / 2; + // Vector3 size = tr - bl; + // size.z = .1f; + // this.boxCollider.center = center; + // this.boxCollider.size = size; + //} } } diff --git a/Scripts/Runtime/TMP_Text.cs b/Scripts/Runtime/TMP_Text.cs index e486e87..a37bf76 100644 --- a/Scripts/Runtime/TMP_Text.cs +++ b/Scripts/Runtime/TMP_Text.cs @@ -1881,17 +1881,23 @@ public void SetText(StringBuilder text) /// public void SetCharArray(char[] sourceText) { - if (sourceText == null || sourceText.Length == 0) - return; - + // Initialize internal character buffer if necessary if (m_char_buffer == null) m_char_buffer = new int[8]; + #if UNITY_EDITOR + // Create new string to be displayed in the Input Text Box of the Editor Panel. + if (sourceText == null || sourceText.Length == 0) + m_text = string.Empty; + else + m_text = new string(sourceText); + #endif + // Clear the Style stack. m_styleStack.Clear(); int writeIndex = 0; - for (int i = 0; i < sourceText.Length; i++) + for (int i = 0; sourceText != null && i < sourceText.Length; i++) { if (sourceText[i] == 92 && i < sourceText.Length - 1) { @@ -1979,11 +1985,24 @@ public void SetCharArray(char[] sourceText) /// public void SetCharArray(char[] sourceText, int start, int length) { - if (sourceText == null || sourceText.Length == 0 || length == 0) - return; - + // Initialize internal character buffer if necessary if (m_char_buffer == null) m_char_buffer = new int[8]; + #if UNITY_EDITOR + // Create new string to be displayed in the Input Text Box of the Editor Panel. + if (sourceText == null || sourceText.Length == 0 || length == 0) + { + m_text = string.Empty; + start = 0; + length = 0; + } + else + { + // TODO: Add potential range check on start + length relative to array size. + m_text = new string(sourceText, start, length); + } + #endif + // Clear the Style stack. m_styleStack.Clear(); @@ -2079,19 +2098,30 @@ public void SetCharArray(char[] sourceText, int start, int length) /// public void SetCharArray(int[] sourceText, int start, int length) { - if (sourceText == null || sourceText.Length == 0 || length == 0) - return; - + // Initialize internal character buffer if necessary if (m_char_buffer == null) m_char_buffer = new int[8]; + #if UNITY_EDITOR + // Create new string to be displayed in the Input Text Box of the Editor Panel. + if (sourceText == null || sourceText.Length == 0 || length == 0) + { + m_text = string.Empty; + start = 0; + length = 0; + } + else + { + m_text = sourceText.IntToString(start, length); + } + #endif + // Clear the Style stack. m_styleStack.Clear(); int writeIndex = 0; - int i = start; int end = start + length; - for (; i < end; i++) + for (int i = start; i < end; i++) { if (sourceText[i] == 92 && i < length - 1) { @@ -3984,7 +4014,7 @@ protected virtual Vector2 CalculatePreferredValues(float defaultFontSize, Vector // Setup Mesh for visible text elements. ie. not a SPACE / LINEFEED / CARRIAGE RETURN. #region Handle Visible Characters - if (charCode == 9 || (!char.IsWhiteSpace((char)charCode) && charCode != 0x200B) || m_textElementType == TMP_TextElementType.Sprite) + if (charCode == 9 || charCode == 0xA0 || charCode == 0x2007 || (!char.IsWhiteSpace((char)charCode) && charCode != 0x200B) || m_textElementType == TMP_TextElementType.Sprite) { // Check if Character exceeds the width of the Text Container #region Handle Line Breaking, Text Auto-Sizing and Horizontal Overflow diff --git a/Scripts/Runtime/TMPro_ExtensionMethods.cs b/Scripts/Runtime/TMPro_ExtensionMethods.cs index d70d2e0..d600fe9 100644 --- a/Scripts/Runtime/TMPro_ExtensionMethods.cs +++ b/Scripts/Runtime/TMPro_ExtensionMethods.cs @@ -20,6 +20,31 @@ public static string ArrayToString(this char[] chars) return s; } + public static string IntToString(this int[] unicodes) + { + char[] chars = new char[unicodes.Length]; + + for (int i = 0; i < unicodes.Length; i++) + { + chars[i] = (char)unicodes[i]; + } + + return new string(chars); + } + + public static string IntToString(this int[] unicodes, int start, int length) + { + char[] chars = new char[length]; + int end = start + length; + + for (int i = start; i < end && i < unicodes.Length; i++) + { + chars[i] = (char)unicodes[i]; + } + + return new string(chars, start, length); + } + public static int FindInstanceID (this List list, T target) where T : Object { diff --git a/Scripts/Runtime/TMPro_Private.cs b/Scripts/Runtime/TMPro_Private.cs index 8b0e4e5..abd2879 100644 --- a/Scripts/Runtime/TMPro_Private.cs +++ b/Scripts/Runtime/TMPro_Private.cs @@ -1,5 +1,5 @@ -//#define PROFILE_ON -//#define PROFILE_PHASES_ON +//#define TMP_PROFILE_ON +//#define TMP_PROFILE_PHASES_ON using UnityEngine; using System; @@ -2400,6 +2400,9 @@ protected override void GenerateTextMesh() m_lastVisibleCharacterOfLine = m_characterCount; m_textInfo.lineInfo[m_lineNumber].spaceCount += 1; m_textInfo.spaceCount += 1; + + if (charCode == 0xA0) + m_textInfo.lineInfo[m_lineNumber].controlCharacterCount += 1; } else { @@ -2439,8 +2442,6 @@ protected override void GenerateTextMesh() { m_textInfo.lineInfo[m_lineNumber].spaceCount += 1; m_textInfo.spaceCount += 1; - - if (charCode == 0xA0) m_textInfo.lineInfo[m_lineNumber].controlCharacterCount = +1; } } #endregion Handle Visible Characters diff --git a/Scripts/Runtime/TMPro_UGUI_Private.cs b/Scripts/Runtime/TMPro_UGUI_Private.cs index 2d1bdbd..8baa472 100644 --- a/Scripts/Runtime/TMPro_UGUI_Private.cs +++ b/Scripts/Runtime/TMPro_UGUI_Private.cs @@ -1,5 +1,5 @@ -//#define PROFILE_ON -//#define PROFILE_PHASES_ON +//#define TMP_PROFILE_ON +//#define TMP_PROFILE_PHASES_ON using UnityEngine; @@ -1027,7 +1027,7 @@ void SetMeshArrays(int size) protected override int SetArraySizes(int[] chars) { //Debug.Log("*** SetArraySizes() on Instance ID (" + GetInstanceID() + ") ***"); - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.BeginSample("SetArraySizes"); #endif @@ -1470,7 +1470,7 @@ protected override int SetArraySizes(int[] chars) } } - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.EndSample(); #endif @@ -1831,7 +1831,7 @@ protected override void GenerateTextMesh() loopCountA += 1; //Profiler.EndSample(); - #if PROFILE_PHASES_ON + #if TMP_PROFILE_PHASES_ON Profiler.BeginSample("TMP Generate Text - Phase I"); #endif @@ -1886,7 +1886,7 @@ protected override void GenerateTextMesh() // Handle Font Styles like LowerCase, UpperCase and SmallCaps. #region Handling of LowerCase, UpperCase and SmallCaps Font Styles - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.BeginSample("Handle Font Style"); #endif float smallCapsMultiplier = 1.0f; @@ -1915,7 +1915,7 @@ protected override void GenerateTextMesh() } } } - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.EndSample(); #endif #endregion @@ -1923,7 +1923,7 @@ protected override void GenerateTextMesh() // Look up Character Data from Dictionary and cache it. #region Look up Character Data - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.BeginSample("Lookup Character Data"); #endif if (m_textElementType == TMP_TextElementType.Sprite) @@ -1976,7 +1976,7 @@ protected override void GenerateTextMesh() padding = m_currentMaterialIndex == 0 ? m_padding : m_subTextObjects[m_currentMaterialIndex].padding; } - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.EndSample(); #endif #endregion @@ -2096,7 +2096,7 @@ protected override void GenerateTextMesh() // Determine the position of the vertices of the Character or Sprite. #region Calculate Vertices Position - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.BeginSample("Calculate Vertices Position"); #endif float fontBaseLineOffset = m_currentFontAsset.fontInfo.Baseline * m_fontScale * m_fontScaleMultiplier * m_currentFontAsset.fontInfo.Scale; @@ -2120,7 +2120,7 @@ protected override void GenerateTextMesh() bottom_right.y = bottom_left.y; bottom_right.z = 0; - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.EndSample(); #endif #endregion @@ -2212,7 +2212,7 @@ protected override void GenerateTextMesh() // Setup Mesh for visible text elements. ie. not a SPACE / LINEFEED / CARRIAGE RETURN. #region Handle Visible Characters - //#if PROFILE_ON + //#if TMP_PROFILE_ON //Profiler.BeginSample("Handle Visible Characters"); //#endif if (charCode == 9 || charCode == 0xA0 || charCode == 0x2007 || (!char.IsWhiteSpace((char)charCode) && charCode != 0x200B) || m_textElementType == TMP_TextElementType.Sprite) @@ -2530,6 +2530,9 @@ protected override void GenerateTextMesh() m_lastVisibleCharacterOfLine = m_characterCount; m_textInfo.lineInfo[m_lineNumber].spaceCount += 1; m_textInfo.spaceCount += 1; + + if (charCode == 0xA0) + m_textInfo.lineInfo[m_lineNumber].controlCharacterCount += 1; } else { @@ -2569,11 +2572,9 @@ protected override void GenerateTextMesh() { m_textInfo.lineInfo[m_lineNumber].spaceCount += 1; m_textInfo.spaceCount += 1; - - if (charCode == 0xA0) m_textInfo.lineInfo[m_lineNumber].controlCharacterCount = +1; } } - //#if PROFILE_ON + //#if TMP_PROFILE_ON //Profiler.EndSample(); //#endif #endregion Handle Visible Characters @@ -2581,7 +2582,7 @@ protected override void GenerateTextMesh() // Check if Line Spacing of previous line needs to be adjusted. #region Adjust Line Spacing - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.BeginSample("Adjust Line Spacing"); #endif if (m_lineNumber > 0 && !TMP_Math.Approximately(m_maxLineAscender, m_startOfLineAscender) && m_lineHeight == TMP_Math.FLOAT_UNSET && !m_isNewPage) @@ -2598,7 +2599,7 @@ protected override void GenerateTextMesh() m_SavedWordWrapState.lineOffset = m_lineOffset; m_SavedWordWrapState.previousLineAscender = m_startOfLineAscender; } - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.EndSample(); #endif #endregion @@ -2616,7 +2617,7 @@ protected override void GenerateTextMesh() // Check if text Exceeds the vertical bounds of the margin area. #region Check Vertical Bounds & Auto-Sizing - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.BeginSample("Check Vertical Bounds"); #endif if (m_maxAscender - elementDescenderII > marginHeight + 0.0001f) @@ -2786,7 +2787,7 @@ protected override void GenerateTextMesh() #endregion End Text Overflow } - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.EndSample(); #endif #endregion Check Vertical Bounds @@ -2840,7 +2841,7 @@ protected override void GenerateTextMesh() // Handle Line Spacing Adjustments + Word Wrapping & special case for last line. #region Check for Line Feed and Last Character - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.BeginSample("Process Linefeed"); #endif if (charCode == 10 || m_characterCount == totalCharacterCount - 1) @@ -2935,7 +2936,7 @@ protected override void GenerateTextMesh() continue; } } - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.EndSample(); #endif #endregion Check for Linefeed or Last Character @@ -2943,7 +2944,7 @@ protected override void GenerateTextMesh() // Store Rectangle positions for each Character. #region Save CharacterInfo for the current character. - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.BeginSample("Save CharacterInfo & Extents"); #endif // Determine the bounds of the Mesh. @@ -2980,7 +2981,7 @@ protected override void GenerateTextMesh() else if (m_characterCount == totalCharacterCount - 1) m_textInfo.pageInfo[m_pageNumber].lastCharacterIndex = m_characterCount; } - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.EndSample(); #endif #endregion Saving CharacterInfo @@ -2988,7 +2989,7 @@ protected override void GenerateTextMesh() // Save State of Mesh Creation for handling of Word Wrapping #region Save Word Wrapping State - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.BeginSample("Save Word Wrapping State"); #endif if (m_enableWordWrapping || m_overflowMode == TextOverflowModes.Truncate || m_overflowMode == TextOverflowModes.Ellipsis) @@ -3024,7 +3025,7 @@ protected override void GenerateTextMesh() SaveWordWrappingState(ref m_SavedWordWrapState, i, m_characterCount); } - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.EndSample(); #endif #endregion Save Word Wrapping State @@ -3052,14 +3053,14 @@ protected override void GenerateTextMesh() m_isCharacterWrappingEnabled = false; - #if PROFILE_PHASES_ON + #if TMP_PROFILE_PHASES_ON Profiler.EndSample(); #endif //Debug.Log("Iteration Count: " + loopCountA + ". Final Point Size: " + m_fontSize); // + " B: " + loopCountB + " C: " + loopCountC + " D: " + loopCountD); // *** PHASE II of Text Generation *** - #if PROFILE_PHASES_ON + #if TMP_PROFILE_PHASES_ON Profiler.BeginSample("TMP Generate Text - Phase II"); #endif @@ -3082,7 +3083,7 @@ protected override void GenerateTextMesh() // Handle Text Alignment #region Text Vertical Alignment - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.BeginSample("Vertical Text Alignment"); #endif Vector3 anchorOffset = Vector3.zero; @@ -3159,7 +3160,7 @@ protected override void GenerateTextMesh() anchorOffset = (corners[0] + corners[1]) / 2 + new Vector3(0 + margins.x, 0 - (m_maxCapHeight - margins.y - margins.w) / 2, 0); break; } - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.EndSample(); #endif #endregion @@ -3219,7 +3220,7 @@ protected override void GenerateTextMesh() // Process Line Justification #region Handle Line Justification - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.BeginSample("Horizontal Text Alignment"); #endif //if (!characterInfos[i].isIgnoringAlignment) @@ -3345,7 +3346,7 @@ protected override void GenerateTextMesh() break; } //} - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.EndSample(); #endif #endregion End Text Justification @@ -3367,7 +3368,7 @@ protected override void GenerateTextMesh() // Setup UV2 based on Character Mapping Options Selected #region Handle UV Mapping Options - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.BeginSample("UV MAPPING"); #endif switch (m_horizontalMapping) @@ -3476,14 +3477,14 @@ protected override void GenerateTextMesh() characterInfos[i].vertex_TR.uv2.y = characterInfos[i].vertex_TL.uv2.y; break; } - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.EndSample(); #endif #endregion End UV Mapping Options // Pack UV's so that we can pass Xscale needed for Shader to maintain 1:1 ratio. #region Pack Scale into UV2 - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.BeginSample("Pack UV"); #endif xScale = characterInfos[i].scale * (1 - m_charWidthAdjDelta); @@ -3527,7 +3528,7 @@ protected override void GenerateTextMesh() characterInfos[i].vertex_TL.uv2.x = PackUV(x0, y1); characterInfos[i].vertex_TL.uv2.y = xScale; characterInfos[i].vertex_TR.uv2.x = PackUV(x1, y1); characterInfos[i].vertex_TR.uv2.y = xScale; characterInfos[i].vertex_BR.uv2.x = PackUV(x1, y0); characterInfos[i].vertex_BR.uv2.y = xScale; - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.EndSample(); #endif #endregion @@ -3541,7 +3542,7 @@ protected override void GenerateTextMesh() // Handle maxVisibleCharacters, maxVisibleLines and Overflow Page Mode. #region Handle maxVisibleCharacters / maxVisibleLines / Page Mode - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.BeginSample("Process MaxVisible Characters & Lines"); #endif if (i < m_maxVisibleCharacters && wordCount < m_maxVisibleWords && currentLine < m_maxVisibleLines && m_overflowMode != TextOverflowModes.Page) @@ -3566,7 +3567,7 @@ protected override void GenerateTextMesh() characterInfos[i].vertex_BR.position = Vector3.zero; characterInfos[i].isVisible = false; } - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.EndSample(); #endif #endregion @@ -3606,7 +3607,7 @@ protected override void GenerateTextMesh() // Need to recompute lineExtent to account for the offset from justification. #region Adjust lineExtents resulting from alignment offset - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.BeginSample("Adjust LineExtents"); #endif if (currentLine != lastLine || i == m_characterCount - 1) @@ -3633,7 +3634,7 @@ protected override void GenerateTextMesh() m_textInfo.lineInfo[currentLine].lineExtents.max = new Vector2(m_textInfo.characterInfo[m_textInfo.lineInfo[currentLine].lastVisibleCharacterIndex].topRight.x, m_textInfo.lineInfo[currentLine].ascender); } } - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.EndSample(); #endif #endregion @@ -3641,7 +3642,7 @@ protected override void GenerateTextMesh() // Track Word Count per line and for the object #region Track Word Count - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.BeginSample("Track Word Count"); #endif if (char.IsLetterOrDigit(currentCharacter) || currentCharacter == 0x2D || currentCharacter == 0xAD || currentCharacter == 0x2010 || currentCharacter == 0x2011) @@ -3700,7 +3701,7 @@ protected override void GenerateTextMesh() m_textInfo.lineInfo[currentLine].wordCount += 1; } } - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.EndSample(); #endif #endregion @@ -3708,7 +3709,7 @@ protected override void GenerateTextMesh() // Setup & Handle Underline #region Underline - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.BeginSample("Process Underline & Strikethrough"); #endif // NOTE: Need to figure out how underline will be handled with multiple fonts and which font will be used for the underline. @@ -4000,7 +4001,7 @@ protected override void GenerateTextMesh() } } #endregion - #if PROFILE_ON + #if TMP_PROFILE_ON Profiler.EndSample(); #endif #endregion @@ -4017,13 +4018,13 @@ protected override void GenerateTextMesh() m_textInfo.wordCount = wordCount != 0 && m_characterCount > 0 ? wordCount : 1; m_textInfo.pageCount = m_pageNumber + 1; - #if PROFILE_PHASES_ON + #if TMP_PROFILE_PHASES_ON Profiler.EndSample(); #endif // *** UPLOAD MESH DATA *** - #if PROFILE_PHASES_ON + #if TMP_PROFILE_PHASES_ON Profiler.BeginSample("TMP Generate Text - Phase III"); #endif if (m_renderMode == TextRenderFlags.Render && IsActive()) @@ -4087,7 +4088,7 @@ protected override void GenerateTextMesh() TMPro_EventManager.ON_TEXT_CHANGED(this); //SendOnTextChanged(); - #if PROFILE_PHASES_ON + #if TMP_PROFILE_PHASES_ON Profiler.EndSample(); #endif diff --git a/package.json b/package.json index d0577fb..46c36e1 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "com.unity.textmeshpro", "displayName": "TextMesh Pro", - "version": "1.3.0-preview", - "unity": "2018.2", + "version": "1.3.0", + "unity": "2018.1", "description": "TextMesh Pro is the ultimate text solution for Unity. It's the perfect replacement for Unity's UI Text and the legacy Text Mesh.\n\nPowerful and easy to use, TextMesh Pro uses Advanced Text Rendering techniques along with a set of custom shaders; delivering substantial visual quality improvements while giving users incredible flexibility when it comes to text styling and texturing.\n\nTextMesh Pro provides Improved Control over text formatting and layout with features like character, word, line and paragraph spacing, kerning, justified text, Links, over 30 Rich Text Tags available, support for Multi Font & Sprites, Custom Styles and more.\n\nGreat performance. Since the geometry created by TextMesh Pro uses two triangles per character just like Unity's text components, this improved visual quality and flexibility comes at no additional performance cost.", "keywords": [ "TextMeshPro", "TextMesh Pro", "Text", "SDF" ], "category": "Text Rendering",