Skip to content

Commit 1ada8e3

Browse files
committed
feat: Make Unity Object compatible with UI text mesh
1 parent 21e3f2c commit 1ada8e3

File tree

5 files changed

+46
-4
lines changed

5 files changed

+46
-4
lines changed

Assets/JCSUnity/Scripts/JCS_UnityObject.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public class JCS_UnityObject : MonoBehaviour
4545
//-- Text
4646
protected Text mText = null;
4747
#if TMP_PRO
48-
//-- Text Mesh Pro
49-
protected TextMeshPro mTextMesh = null;
48+
//-- Text Mesh Pro Ui
49+
protected TMP_Text mTextMesh = null;
5050
#endif
5151

5252
[Header("Material")]
@@ -73,7 +73,7 @@ public void SetObjectType(JCS_UnityObjectType ob)
7373
public RectTransform GetRectTransform() { return this.mRectTransform; }
7474
public Text GetText() { return this.mText; }
7575
#if TMP_PRO
76-
public TextMeshPro GetTextMesh() { return this.mTextMesh; }
76+
public TMP_Text GetTextMesh() { return this.mTextMesh; }
7777
#endif
7878
public bool MakeUnique { get { return this.mMakeUnique; } set { this.mMakeUnique = value; } }
7979
public List<string> ColorProps { get { return this.mColorProps; } set { this.mColorProps = value; } }

Assets/_Project/Scenes/UI/FT_UITest.unity

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5236,7 +5236,7 @@ MonoBehaviour:
52365236
mTweenToB: {x: 5, y: 5, z: 5}
52375237
mContinueKeyTween: 99
52385238
mContinueTween: 0
5239-
mTargetTransform: {fileID: 0}
5239+
mTarget: {fileID: 0}
52405240
mDoneTweenX: 1
52415241
mDoneTweenY: 1
52425242
mDoneTweenZ: 1

Assets/_Project/Scripts/UI.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* $File: FT_TextMesh.cs $
3+
* $Date: 2025-03-03 05:10:36 $
4+
* $Revision: $
5+
* $Creator: Jen-Chieh Shen $
6+
* $Notice: See LICENSE.txt for modification and distribution information
7+
* Copyright (c) 2025 by Shen, Jen-Chieh $
8+
*/
9+
using UnityEngine;
10+
using TMPro;
11+
12+
/// <summary>
13+
/// Test text mesh components.
14+
/// </summary>
15+
public class FT_TextMesh : MonoBehaviour
16+
{
17+
/* Variables */
18+
19+
public TextMeshPro textMesh = null;
20+
21+
public TMP_Text tmpText = null;
22+
23+
/* Setter & Getter */
24+
25+
/* Functions */
26+
27+
private void Awake()
28+
{
29+
this.textMesh = GetComponent<TextMeshPro>();
30+
this.tmpText = GetComponent<TMP_Text>();
31+
}
32+
}

Assets/_Project/Scripts/UI/FT_TextMesh.cs.meta

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)