Skip to content

Commit 83ba776

Browse files
author
Unity Technologies
committed
## [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
1 parent a088c46 commit 83ba776

File tree

8 files changed

+91
-7
lines changed

8 files changed

+91
-7
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Changelog
22
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
33

4+
## [3.2.0-pre.6] - 2023-09-25
5+
### Changes
6+
- Fix TextMeshPro component does not perform linear color conversion when the VertexColorAlwaysGammaSpace option is enabled. Case #UUM-36113
7+
- Addressed issue surrounding dropdown not closing correctly in certain situations. Case #UUM-33691
8+
- Fixed Multi Line Newline input field from not accepting any new line past the set line limit. Case #UUM-42585
9+
410
## [3.2.0-pre.5] - 2023-07-07
511
### Changes
612
- 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)
Binary file not shown.

Scripts/Editor/TMP_EditorResourceManager.cs

+14-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,13 @@ private TMP_EditorResourceManager()
7777
if (RenderPipelineManager.currentPipeline == null)
7878
Camera.onPostRender += OnCameraPostRender;
7979
else
80-
RenderPipelineManager.endFrameRendering += OnEndOfFrame;
80+
{
81+
#if UNITY_2023_3_OR_NEWER
82+
RenderPipelineManager.endContextRendering += OnEndOfFrame;
83+
#else
84+
RenderPipelineManager.endFrameRendering += OnEndOfFrame;
85+
#endif
86+
}
8187

8288
Canvas.willRenderCanvases += OnPreRenderCanvases;
8389
}
@@ -96,10 +102,17 @@ void OnPreRenderCanvases()
96102
DoPreRenderUpdates();
97103
}
98104

105+
#if UNITY_2023_3_OR_NEWER
106+
void OnEndOfFrame(ScriptableRenderContext renderContext, List<Camera> cameras)
107+
{
108+
DoPostRenderUpdates();
109+
}
110+
#else
99111
void OnEndOfFrame(ScriptableRenderContext renderContext, Camera[] cameras)
100112
{
101113
DoPostRenderUpdates();
102114
}
115+
#endif
103116

104117
/// <summary>
105118
/// Register resource for re-import.

Scripts/Runtime/TMP_Dropdown.cs

+4
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,10 @@ protected virtual GameObject CreateBlocker(Canvas rootCanvas)
10641064
Button blockerButton = blocker.AddComponent<Button>();
10651065
blockerButton.onClick.AddListener(Hide);
10661066

1067+
//add canvas group to ensure clicking outside the dropdown will hide it (UUM-33691)
1068+
CanvasGroup blockerCanvasGroup = blocker.AddComponent<CanvasGroup>();
1069+
blockerCanvasGroup.ignoreParentGroups = true;
1070+
10671071
return blocker;
10681072
}
10691073

Scripts/Runtime/TMP_InputField.cs

+10
Original file line numberDiff line numberDiff line change
@@ -2232,6 +2232,16 @@ protected EditState KeyPressed(Event evt)
22322232
m_ReleaseSelection = true;
22332233
return EditState.Finish;
22342234
}
2235+
else
2236+
{
2237+
TMP_TextInfo textInfo = m_TextComponent.textInfo;
2238+
2239+
if (textInfo != null && textInfo.lineCount >= m_LineLimit)
2240+
{
2241+
m_ReleaseSelection = true;
2242+
return EditState.Finish;
2243+
}
2244+
}
22352245
break;
22362246
}
22372247

Scripts/Runtime/TMP_Settings.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static string version
3434
[SerializeField]
3535
internal string assetVersion;
3636

37-
internal static string s_CurrentAssetVersion = "1";
37+
internal static string s_CurrentAssetVersion = "2";
3838

3939
internal void SetAssetVersion()
4040
{

Tests/Runtime/TMP_RuntimeTests.cs

+52-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
using NUnit.Framework;
33
using System.IO;
44
using System.Collections.Generic;
5-
5+
using UnityEngine.UI;
6+
using UnityEngine.EventSystems;
67

78
namespace TMPro
89
{
@@ -183,6 +184,56 @@ public void Parsing_TextInfo_RichText(int sourceTextIndex, int characterCount, i
183184
Assert.AreEqual(m_TextComponent.textInfo.lineCount, lineCount);
184185
}
185186

187+
public static IEnumerable<object[]> TestCases_MultiLineNewline_OnLastLine_WhenPressedEnter_Caret_ShouldNotGoto_NextLine()
188+
{
189+
yield return new object[] { 1, 1 };
190+
yield return new object[] { 2, 2 };
191+
yield return new object[] { 3, 3 };
192+
yield return new object[] { 4, 4 };
193+
yield return new object[] { 5, 5 };
194+
yield return new object[] { 6, 6 };
195+
}
196+
197+
[Test, TestCaseSource("TestCases_MultiLineNewline_OnLastLine_WhenPressedEnter_Caret_ShouldNotGoto_NextLine")]
198+
public void MultiLineNewline_OnLastLine_WhenPressedEnter_Caret_ShouldNotGoto_NextLine(int lineLimit, int expectedLineCount)
199+
{
200+
GameObject cameraObject = new GameObject("Camera Object", typeof(Camera));
201+
GameObject canvasObject = new GameObject("Canvas Object", typeof(Canvas), typeof(GraphicRaycaster));
202+
canvasObject.GetComponent<Canvas>().renderMode = RenderMode.ScreenSpaceOverlay;
203+
GameObject inputObject = new GameObject("Input Object", typeof(TMP_InputField));
204+
inputObject.transform.parent = canvasObject.transform;
205+
inputObject.AddComponent<Image>();
206+
TMP_InputField m_InputField = inputObject.GetComponent<TMP_InputField>();
207+
m_InputField.targetGraphic = inputObject.GetComponent<Image>();
208+
m_InputField.textComponent = m_TextComponent;
209+
m_InputField.lineType = TMP_InputField.LineType.MultiLineNewline;
210+
m_InputField.lineLimit = lineLimit;
211+
212+
GameObject eventGameObject = new GameObject("Event Object", typeof(EventSystem), typeof(StandaloneInputModule));
213+
Event enterKeyDownEvent = new Event { type = EventType.KeyDown, keyCode = KeyCode.KeypadEnter, modifiers = EventModifiers.None, character = '\n' };
214+
215+
m_InputField.text = "POTUS";
216+
EventSystem.current.SetSelectedGameObject(inputObject);
217+
m_InputField.ActivateInputField();
218+
int count = 0;
219+
while (count < lineLimit + 3)
220+
{
221+
m_InputField.ProcessEvent(enterKeyDownEvent);
222+
m_InputField.ForceLabelUpdate();
223+
count++;
224+
}
225+
226+
m_InputField.textComponent.ForceMeshUpdate();
227+
CanvasUpdateRegistry.RegisterCanvasElementForGraphicRebuild(m_InputField);
228+
229+
m_InputField.DeactivateInputField();
230+
GameObject.Destroy(eventGameObject);
231+
GameObject.Destroy(inputObject);
232+
GameObject.Destroy(canvasObject);
233+
GameObject.Destroy(cameraObject);
234+
235+
Assert.AreEqual(m_TextComponent.textInfo.lineCount, expectedLineCount);
236+
}
186237

187238
//[OneTimeTearDown]
188239
//public void Cleanup()

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.unity.textmeshpro",
33
"displayName": "TextMeshPro",
4-
"version": "3.2.0-pre.5",
4+
"version": "3.2.0-pre.6",
55
"unity": "2020.3",
66
"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.",
77
"keywords": [
@@ -16,15 +16,15 @@
1616
"com.unity.ugui": "1.0.0"
1717
},
1818
"_upm": {
19-
"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"
19+
"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"
2020
},
2121
"upmCi": {
22-
"footprint": "fc8d6e47ccb2e8eaa4bbff84c935be20074cee43"
22+
"footprint": "a8e38db0379d59354c856907ccc8155d9ebb6986"
2323
},
2424
"documentationUrl": "https://docs.unity3d.com/Packages/[email protected]/manual/index.html",
2525
"repository": {
2626
"url": "https://github.cds.internal.unity3d.com/unity/unity.git",
2727
"type": "git",
28-
"revision": "9a6f6e5097f5a48ffe942c51b2a4cc733f8bc3d5"
28+
"revision": "9e6fd1eba5042538628bbff3a2c33ce1af0b3e98"
2929
}
3030
}

0 commit comments

Comments
 (0)