Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [3.2.0-pre.6] - 2023-09-25
### Changes
- Fix TextMeshPro component does not perform linear color conversion when the VertexColorAlwaysGammaSpace option is enabled. Case #UUM-36113
- Addressed issue surrounding dropdown not closing correctly in certain situations. Case #UUM-33691
- Fixed Multi Line Newline input field from not accepting any new line past the set line limit. Case #UUM-42585
  • Loading branch information
Unity Technologies committed Sep 25, 2023
1 parent a088c46 commit 83ba776
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# 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

## [3.2.0-pre.6] - 2023-09-25
### Changes
- Fix TextMeshPro component does not perform linear color conversion when the VertexColorAlwaysGammaSpace option is enabled. Case #UUM-36113
- Addressed issue surrounding dropdown not closing correctly in certain situations. Case #UUM-33691
- Fixed Multi Line Newline input field from not accepting any new line past the set line limit. Case #UUM-42585

## [3.2.0-pre.5] - 2023-07-07
### Changes
- Fixed Input Field not handling submit and cancel for Gamepad and other input devices. [UUM-5093](https://issuetracker.unity3d.com/issues/gamepad-cannot-submit-or-exit-inputfield)
Expand Down
Binary file modified Package Resources/TMP Essential Resources.unitypackage
Binary file not shown.
15 changes: 14 additions & 1 deletion Scripts/Editor/TMP_EditorResourceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@ private TMP_EditorResourceManager()
if (RenderPipelineManager.currentPipeline == null)
Camera.onPostRender += OnCameraPostRender;
else
RenderPipelineManager.endFrameRendering += OnEndOfFrame;
{
#if UNITY_2023_3_OR_NEWER
RenderPipelineManager.endContextRendering += OnEndOfFrame;
#else
RenderPipelineManager.endFrameRendering += OnEndOfFrame;
#endif
}

Canvas.willRenderCanvases += OnPreRenderCanvases;
}
Expand All @@ -96,10 +102,17 @@ void OnPreRenderCanvases()
DoPreRenderUpdates();
}

#if UNITY_2023_3_OR_NEWER
void OnEndOfFrame(ScriptableRenderContext renderContext, List<Camera> cameras)
{
DoPostRenderUpdates();
}
#else
void OnEndOfFrame(ScriptableRenderContext renderContext, Camera[] cameras)
{
DoPostRenderUpdates();
}
#endif

/// <summary>
/// Register resource for re-import.
Expand Down
4 changes: 4 additions & 0 deletions Scripts/Runtime/TMP_Dropdown.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,10 @@ protected virtual GameObject CreateBlocker(Canvas rootCanvas)
Button blockerButton = blocker.AddComponent<Button>();
blockerButton.onClick.AddListener(Hide);

//add canvas group to ensure clicking outside the dropdown will hide it (UUM-33691)
CanvasGroup blockerCanvasGroup = blocker.AddComponent<CanvasGroup>();
blockerCanvasGroup.ignoreParentGroups = true;

return blocker;
}

Expand Down
10 changes: 10 additions & 0 deletions Scripts/Runtime/TMP_InputField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2232,6 +2232,16 @@ protected EditState KeyPressed(Event evt)
m_ReleaseSelection = true;
return EditState.Finish;
}
else
{
TMP_TextInfo textInfo = m_TextComponent.textInfo;

if (textInfo != null && textInfo.lineCount >= m_LineLimit)
{
m_ReleaseSelection = true;
return EditState.Finish;
}
}
break;
}

Expand Down
2 changes: 1 addition & 1 deletion Scripts/Runtime/TMP_Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static string version
[SerializeField]
internal string assetVersion;

internal static string s_CurrentAssetVersion = "1";
internal static string s_CurrentAssetVersion = "2";

internal void SetAssetVersion()
{
Expand Down
53 changes: 52 additions & 1 deletion Tests/Runtime/TMP_RuntimeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
using NUnit.Framework;
using System.IO;
using System.Collections.Generic;

using UnityEngine.UI;
using UnityEngine.EventSystems;

namespace TMPro
{
Expand Down Expand Up @@ -183,6 +184,56 @@ public void Parsing_TextInfo_RichText(int sourceTextIndex, int characterCount, i
Assert.AreEqual(m_TextComponent.textInfo.lineCount, lineCount);
}

public static IEnumerable<object[]> TestCases_MultiLineNewline_OnLastLine_WhenPressedEnter_Caret_ShouldNotGoto_NextLine()
{
yield return new object[] { 1, 1 };
yield return new object[] { 2, 2 };
yield return new object[] { 3, 3 };
yield return new object[] { 4, 4 };
yield return new object[] { 5, 5 };
yield return new object[] { 6, 6 };
}

[Test, TestCaseSource("TestCases_MultiLineNewline_OnLastLine_WhenPressedEnter_Caret_ShouldNotGoto_NextLine")]
public void MultiLineNewline_OnLastLine_WhenPressedEnter_Caret_ShouldNotGoto_NextLine(int lineLimit, int expectedLineCount)
{
GameObject cameraObject = new GameObject("Camera Object", typeof(Camera));
GameObject canvasObject = new GameObject("Canvas Object", typeof(Canvas), typeof(GraphicRaycaster));
canvasObject.GetComponent<Canvas>().renderMode = RenderMode.ScreenSpaceOverlay;
GameObject inputObject = new GameObject("Input Object", typeof(TMP_InputField));
inputObject.transform.parent = canvasObject.transform;
inputObject.AddComponent<Image>();
TMP_InputField m_InputField = inputObject.GetComponent<TMP_InputField>();
m_InputField.targetGraphic = inputObject.GetComponent<Image>();
m_InputField.textComponent = m_TextComponent;
m_InputField.lineType = TMP_InputField.LineType.MultiLineNewline;
m_InputField.lineLimit = lineLimit;

GameObject eventGameObject = new GameObject("Event Object", typeof(EventSystem), typeof(StandaloneInputModule));
Event enterKeyDownEvent = new Event { type = EventType.KeyDown, keyCode = KeyCode.KeypadEnter, modifiers = EventModifiers.None, character = '\n' };

m_InputField.text = "POTUS";
EventSystem.current.SetSelectedGameObject(inputObject);
m_InputField.ActivateInputField();
int count = 0;
while (count < lineLimit + 3)
{
m_InputField.ProcessEvent(enterKeyDownEvent);
m_InputField.ForceLabelUpdate();
count++;
}

m_InputField.textComponent.ForceMeshUpdate();
CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(m_InputField);

m_InputField.DeactivateInputField();
GameObject.Destroy(eventGameObject);
GameObject.Destroy(inputObject);
GameObject.Destroy(canvasObject);
GameObject.Destroy(cameraObject);

Assert.AreEqual(m_TextComponent.textInfo.lineCount, expectedLineCount);
}

//[OneTimeTearDown]
//public void Cleanup()
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.unity.textmeshpro",
"displayName": "TextMeshPro",
"version": "3.2.0-pre.5",
"version": "3.2.0-pre.6",
"unity": "2020.3",
"description": "TextMeshPro 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, TextMeshPro (also known as TMP) 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\nTextMeshPro 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 TextMeshPro uses two triangles per character just like Unity's text components, this improved visual quality and flexibility comes at no additional performance cost.\n\n\n\nUPGRADE NOTE\n--------------------\nThis latest release of the TMP package includes updated TMP Essential Resources and TMP Examples & Extras. Be sure to update those via the \"Window - TextMeshPro - Import...\" menu options.",
"keywords": [
Expand All @@ -16,15 +16,15 @@
"com.unity.ugui": "1.0.0"
},
"_upm": {
"changelog": "### Changes\n- Fixed Input Field not handling submit and cancel for Gamepad and other input devices. [UUM-5093](https://issuetracker.unity3d.com/issues/gamepad-cannot-submit-or-exit-inputfield)\n- Fixed Input Field showing square character and warning when control characters are entered. (UUM-24871)\n- Fixed TextMeshPro crash when upgrading materials. Case #TMPB-187\n- Ensured PreferredHeight handles various line heights correctly in TextMeshPro. Case #TMPB-165\n- Set FaceInfo setter to public in TextMeshPro. Case #TMPB-182\n- Ensured sprites used correct indexes in TextMeshPro. Case #TMPB-200\n- Made Maskable now propagates to SubMesh in TextMeshPro. Case #TMPB-191\n- Added missing _ScaleRatioA to HDRP and URP shaders in TextMeshPro. Case #TMPB-169\n- Fixed TextCore crash when upgrading materials. Case #UUM-32513"
"changelog": "### Changes\n- Fix TextMeshPro component does not perform linear color conversion when the VertexColorAlwaysGammaSpace option is enabled. Case #UUM-36113\n- Addressed issue surrounding dropdown not closing correctly in certain situations. Case #UUM-33691\n- Fixed Multi Line Newline input field from not accepting any new line past the set line limit. Case #UUM-42585"
},
"upmCi": {
"footprint": "fc8d6e47ccb2e8eaa4bbff84c935be20074cee43"
"footprint": "a8e38db0379d59354c856907ccc8155d9ebb6986"
},
"documentationUrl": "https://docs.unity3d.com/Packages/[email protected]/manual/index.html",
"repository": {
"url": "https://github.cds.internal.unity3d.com/unity/unity.git",
"type": "git",
"revision": "9a6f6e5097f5a48ffe942c51b2a4cc733f8bc3d5"
"revision": "9e6fd1eba5042538628bbff3a2c33ce1af0b3e98"
}
}

0 comments on commit 83ba776

Please sign in to comment.