Skip to content

Commit 7725b59

Browse files
Fixing editor compilation errors
The 'textWrappingMode' enum property is only available in the TextMeshPro shipping with Unity 6+; on older versions we fall back to the 'enableWordWrapping' boolean.
1 parent 8a57d62 commit 7725b59

4 files changed

Lines changed: 16 additions & 7 deletions

File tree

Assets/QA/Tests/Core Platform Menu/SceneMenu.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,13 @@ void BuildSearchBar(Transform parent)
382382
var ph = MakeText("Placeholder", textArea.transform, "Search scenes\u2026", 18,
383383
kTextSecondary, TextAlignmentOptions.MidlineLeft);
384384
ph.fontStyle = FontStyles.Italic;
385-
ph.textWrappingMode = TextWrappingModes.NoWrap;
385+
DisableWordWrap(ph);
386386
ph.overflowMode = TextOverflowModes.Ellipsis;
387387
Stretch(ph.gameObject);
388388

389389
var txt = MakeText("Text", textArea.transform, "", 18,
390390
kTextPrimary, TextAlignmentOptions.MidlineLeft);
391-
txt.textWrappingMode = TextWrappingModes.NoWrap;
391+
DisableWordWrap(txt);
392392
Stretch(txt.gameObject);
393393

394394
var input = bar.AddComponent<TMP_InputField>();
@@ -614,7 +614,7 @@ void BuildSceneButton(Transform parent, SceneEntry entry)
614614
var nameT = MakeText("Name", go.transform, entry.displayName, 15, kTextPrimary,
615615
TextAlignmentOptions.Center);
616616
nameT.overflowMode = TextOverflowModes.Ellipsis;
617-
nameT.textWrappingMode = TextWrappingModes.NoWrap;
617+
DisableWordWrap(nameT);
618618
var nr = Rect(nameT);
619619
nr.anchorMin = new Vector2(0.04f, 0.38f);
620620
nr.anchorMax = new Vector2(0.96f, 0.94f);
@@ -626,7 +626,7 @@ void BuildSceneButton(Transform parent, SceneEntry entry)
626626
var subT = MakeText("Sub", go.transform, entry.subcategory, 11, kTextSecondary,
627627
TextAlignmentOptions.Center);
628628
subT.overflowMode = TextOverflowModes.Ellipsis;
629-
subT.textWrappingMode = TextWrappingModes.NoWrap;
629+
DisableWordWrap(subT);
630630
var srr = Rect(subT);
631631
srr.anchorMin = new Vector2(0.04f, 0.06f);
632632
srr.anchorMax = new Vector2(0.96f, 0.38f);
@@ -714,6 +714,15 @@ static TextMeshProUGUI MakeText(string name, Transform parent, string text, floa
714714
return t;
715715
}
716716

717+
static void DisableWordWrap(TMP_Text t)
718+
{
719+
#if UNITY_6000_0_OR_NEWER
720+
t.textWrappingMode = TextWrappingModes.NoWrap;
721+
#else
722+
t.enableWordWrapping = false;
723+
#endif
724+
}
725+
717726
static void Stretch(GameObject go)
718727
{
719728
var r = go.GetComponent<RectTransform>();

Assets/Samples/InGameHints/InGameHintsActions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
4-
// version 1.19.1
4+
// version 1.20.0
55
// from Assets/Samples/InGameHints/InGameHintsActions.inputactions
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

Assets/Samples/SimpleDemo/SimpleControls.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
4-
// version 1.19.1
4+
// version 1.20.0
55
// from Assets/Samples/SimpleDemo/SimpleControls.inputactions
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

Assets/Tests/InputSystem/InputActionCodeGeneratorActions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
4-
// version 1.19.1
4+
// version 1.20.0
55
// from Assets/Tests/InputSystem/InputActionCodeGeneratorActions.inputactions
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

0 commit comments

Comments
 (0)