Skip to content

Commit 63cd700

Browse files
committed
define REACT_TMP for 2023.2
1 parent b991e2a commit 63cd700

File tree

7 files changed

+44
-6
lines changed

7 files changed

+44
-6
lines changed

Editor/Resources/ReactUnity/tests/PanelSettings.asset

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ MonoBehaviour:
1515
themeUss: {fileID: -4733365628477956816, guid: 5827889da7889804cbd452f4d69399d8,
1616
type: 3}
1717
m_TargetTexture: {fileID: 8400000, guid: b410ee09ecde5c54a88baf05a247c4bd, type: 2}
18+
m_RenderMode: 0
19+
m_WorldSpaceLayer: 0
1820
m_ScaleMode: 1
1921
m_ReferenceSpritePixelsPerUnit: 100
22+
m_PixelsPerUnit: 100
2023
m_Scale: 1
2124
m_ReferenceDpi: 96
2225
m_FallbackDpi: 96
@@ -25,9 +28,11 @@ MonoBehaviour:
2528
m_Match: 0
2629
m_SortingOrder: 0
2730
m_TargetDisplay: 0
31+
m_BindingLogLevel: 0
2832
m_ClearDepthStencil: 1
2933
m_ClearColor: 0
3034
m_ColorClearValue: {r: 0, g: 0, b: 0, a: 0}
35+
m_VertexBudget: 0
3136
m_DynamicAtlasSettings:
3237
m_MinAtlasSize: 64
3338
m_MaxAtlasSize: 4096

Editor/Resources/ReactUnity/tests/UIToolkitRenderTexture.renderTexture

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ RenderTexture:
1010
m_ImageContentsHash:
1111
serializedVersion: 2
1212
Hash: 00000000000000000000000000000000
13-
m_ForcedFallbackFormat: 4
14-
m_DownscaleFallback: 0
1513
m_IsAlphaChannelOptional: 0
16-
serializedVersion: 5
14+
serializedVersion: 6
1715
m_Width: 1000
1816
m_Height: 1000
1917
m_AntiAliasing: 1
@@ -24,8 +22,10 @@ RenderTexture:
2422
m_GenerateMips: 1
2523
m_SRGB: 0
2624
m_UseDynamicScale: 0
25+
m_UseDynamicScaleExplicit: 0
2726
m_BindMS: 0
2827
m_EnableCompatibleFormat: 1
28+
m_EnableRandomWrite: 0
2929
m_TextureSettings:
3030
serializedVersion: 2
3131
m_FilterMode: 1

Runtime/Frameworks/UGUI/Components/TextComponent.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public FontReference Font
4343
font?.Get(Context, ft => {
4444
if (font != value) return;
4545

46+
#if REACT_TMP
4647
if (ft?.TmpFontAsset)
4748
{
4849
var asset = ft.TmpFontAsset;
@@ -51,6 +52,7 @@ public FontReference Font
5152
RecalculateFontStyleAndWeight(style.fontStyle, style.fontWeight, style.textTransform);
5253
RecalculateLineHeight();
5354
}
55+
#endif
5456
});
5557
}
5658
}

Runtime/Frameworks/UGUI/ReactUnity.UGUI.asmdef

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@
5555
"name": "com.nosuchstudio.rtltmpro",
5656
"expression": "",
5757
"define": "REACT_RTLTMPRO"
58+
},
59+
{
60+
"name": "Unity",
61+
"expression": "2023.2",
62+
"define": "REACT_TMP"
63+
},
64+
{
65+
"name": "Unity",
66+
"expression": "2023.2",
67+
"define": "REACT_TMP_X2"
5868
}
5969
],
6070
"noEngineReferences": false

Runtime/Frameworks/UIToolkit/ReactUnity.UIToolkit.asmdef

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
"name": "com.unity.vectorgraphics",
3535
"expression": "",
3636
"define": "REACT_VECTOR_GRAPHICS"
37+
},
38+
{
39+
"name": "Unity",
40+
"expression": "2023.2",
41+
"define": "REACT_TMP"
3742
}
3843
],
3944
"noEngineReferences": false

Runtime/ReactUnity.asmdef

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,16 @@
9292
"name": "cc.starlessnight.unity-jsb",
9393
"expression": "",
9494
"define": "REACT_QUICKJS_AVAILABLE"
95+
},
96+
{
97+
"name": "Unity",
98+
"expression": "2023.2",
99+
"define": "REACT_TMP"
100+
},
101+
{
102+
"name": "Unity",
103+
"expression": "2023.2",
104+
"define": "REACT_TMP_X2"
95105
}
96106
],
97107
"noEngineReferences": false

Runtime/Types/FontReference.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,21 @@ protected override void Get(ReactContext context, AssetReferenceType realType, o
8383
}
8484
else
8585
{
86-
Font altFont;
86+
Font altFont = null;
8787
#if REACT_TMP
8888
var tmpFontAsset = base.Get<TMPro.TMP_FontAsset>(context, realType, realValue);
89-
altFont = tmpFontAsset?.sourceFontFile;
89+
if (tmpFontAsset?.sourceFontFile != null)
90+
{
91+
altFont = tmpFontAsset?.sourceFontFile;
92+
}
9093
#endif
9194

9295
#if REACT_TEXTCORE
9396
var textCoreFontAsset = base.Get<UnityEngine.TextCore.Text.FontAsset>(context, realType, realValue);
94-
altFont = textCoreFontAsset?.sourceFontFile ?? altFont;
97+
if (textCoreFontAsset?.sourceFontFile != null)
98+
{
99+
altFont = textCoreFontAsset?.sourceFontFile ?? altFont;
100+
}
95101
#endif
96102

97103
var res = new FontSource

0 commit comments

Comments
 (0)