Skip to content

Commit 61ab9fc

Browse files
committed
add support for TMP preview features
1 parent 5d79859 commit 61ab9fc

File tree

9 files changed

+2064
-191
lines changed

9 files changed

+2064
-191
lines changed
File renamed without changes.
Lines changed: 2024 additions & 189 deletions
Large diffs are not rendered by default.
File renamed without changes.

Editor/Developer/TypescriptModelsGenerator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public static void GenerateUnity()
3535
typeof(UnityEngine.BuildCompression).Assembly,
3636
typeof(UnityEngine.Analytics.Analytics).Assembly,
3737
typeof(UnityEngine.UIElements.VisualElement).Assembly,
38+
typeof(UnityEngine.UIElements.LineJoin).Assembly,
3839
typeof(UnityEngine.AI.NavMesh).Assembly,
3940
typeof(UnityEngine.TestTools.LogAssert).Assembly,
4041
#if UNITY_2021_2_OR_NEWER

Editor/ReactUnityBuildModifier.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,35 @@ public class ReactUnityBuildModifier : IPostprocessBuildWithReport
2323

2424
static ReactUnityBuildModifier()
2525
{
26-
#if REACT_QUICKJS
26+
#if REACT_QUICKJS && !(JSB_UNITYLESS && JSB_RUNTIME_REFLECT_BINDING)
2727
BuildPlayerWindow.RegisterGetBuildPlayerOptionsHandler(ModifyBuildOptions);
2828
#endif
2929
}
3030

3131
private static BuildPlayerOptions ModifyBuildOptions(BuildPlayerOptions options)
3232
{
3333
options = BuildPlayerWindow.DefaultBuildMethods.GetBuildPlayerOptions(options);
34-
3534
#if REACT_QUICKJS
35+
36+
#if !UNITY_2020_1_OR_NEWER
37+
38+
#if !(JSB_UNITYLESS && JSB_RUNTIME_REFLECT_BINDING)
39+
throw new BuildFailedException("JSB_UNITYLESS and JSB_RUNTIME_REFLECT_BINDING must be defined for QuickJS builds");
40+
#endif
41+
42+
#else
3643
var newDefines = new System.Collections.Generic.List<string>(options.extraScriptingDefines ?? new string[0]);
3744
newDefines.Add("JSB_UNITYLESS");
3845
newDefines.Add("JSB_RUNTIME_REFLECT_BINDING");
3946

4047
options.extraScriptingDefines = newDefines.ToArray();
4148
#endif
4249

50+
#endif
51+
52+
#pragma warning disable CS0162 // Unreachable code detected
4353
return options;
54+
#pragma warning restore CS0162 // Unreachable code detected
4455
}
4556

4657
public void OnPostprocessBuild(BuildReport report)

Runtime/Frameworks/UGUI/Components/TextComponent.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,13 @@ protected override void ApplyStylesSelf()
105105
var fontSize = style.fontSize;
106106
Text.fontSize = fontSize;
107107
Text.color = style.color;
108+
109+
#if REACT_TMP_X2
110+
Text.textWrappingMode = style.textWrap ? TextWrappingModes.Normal : TextWrappingModes.NoWrap;
111+
#else
108112
Text.enableWordWrapping = style.textWrap;
113+
#endif
114+
109115
Text.alignment = style.textAlign;
110116
Text.overflowMode = style.textOverflow;
111117
Text.outlineWidth = style.textStrokeWidth;

Runtime/Frameworks/UGUI/ReactUnity.UGUI.asmdef

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@
3737
"name": "com.unity.vectorgraphics",
3838
"expression": "",
3939
"define": "REACT_VECTOR_GRAPHICS"
40+
},
41+
{
42+
"name": "com.unity.textmeshpro",
43+
"expression": "3.2.0-pre.0",
44+
"define": "REACT_TMP_X2"
45+
},
46+
{
47+
"name": "com.unity.textmeshpro",
48+
"expression": "[2.2.0-preview.0,3.0.0)",
49+
"define": "REACT_TMP_X2"
4050
}
4151
],
4252
"noEngineReferences": false

Runtime/ReactUnity.asmdef

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@
7474
"name": "cc.starlessnight.unity-jsb",
7575
"expression": "",
7676
"define": "REACT_QUICKJS_AVAILABLE"
77+
},
78+
{
79+
"name": "com.unity.textmeshpro",
80+
"expression": "3.2.0-pre.0",
81+
"define": "REACT_TMP_X2"
82+
},
83+
{
84+
"name": "com.unity.textmeshpro",
85+
"expression": "[2.2.0-preview.0,3.0.0)",
86+
"define": "REACT_TMP_X2"
7787
}
7888
],
7989
"noEngineReferences": false

0 commit comments

Comments
 (0)