@@ -102,7 +102,7 @@ class TextBlobMesh : PoolObject {
102
102
static readonly Dictionary < MeshKey , MeshInfo > _meshes = new Dictionary < MeshKey , MeshInfo > ( ) ;
103
103
static long _frameCount = 0 ;
104
104
105
- public TextBlob textBlob ;
105
+ public TextBlob ? textBlob ;
106
106
public float scale ;
107
107
public uiMatrix3 matrix ;
108
108
@@ -116,6 +116,7 @@ public override void clear() {
116
116
ObjectPool < uiMeshMesh > . release ( this . _mesh ) ;
117
117
this . _mesh = null ;
118
118
this . _resolved = false ;
119
+ this . textBlob = null ;
119
120
}
120
121
121
122
public static TextBlobMesh create ( TextBlob textBlob , float scale , uiMatrix3 matrix ) {
@@ -160,10 +161,10 @@ public uiMeshMesh resolveMesh() {
160
161
161
162
this . _resolved = true ;
162
163
163
- var style = this . textBlob . style ;
164
+ var style = this . textBlob . Value . style ;
164
165
165
- var text = this . textBlob . text ;
166
- var key = MeshKey . create ( this . textBlob . instanceId , this . scale ) ;
166
+ var text = this . textBlob . Value . text ;
167
+ var key = MeshKey . create ( this . textBlob . Value . instanceId , this . scale ) ;
167
168
var fontInfo = FontManager . instance . getOrCreate ( style . fontFamily , style . fontWeight , style . fontStyle ) ;
168
169
var font = fontInfo . font ;
169
170
@@ -176,7 +177,7 @@ public uiMeshMesh resolveMesh() {
176
177
}
177
178
178
179
// Handling Emoji
179
- char startingChar = text [ this . textBlob . textOffset ] ;
180
+ char startingChar = text [ this . textBlob . Value . textOffset ] ;
180
181
if ( char . IsHighSurrogate ( startingChar ) || EmojiUtils . isSingleCharEmoji ( startingChar ) ) {
181
182
var vert = ObjectPool < uiList < Vector3 > > . alloc ( ) ;
182
183
var tri = ObjectPool < uiList < int > > . alloc ( ) ;
@@ -189,13 +190,13 @@ public uiMeshMesh resolveMesh() {
189
190
var minY = minMaxRect . top ;
190
191
var maxY = minMaxRect . bottom ;
191
192
192
- for ( int i = 0 ; i < this . textBlob . textSize ; i ++ ) {
193
- char a = text [ this . textBlob . textOffset + i ] ;
193
+ for ( int i = 0 ; i < this . textBlob . Value . textSize ; i ++ ) {
194
+ char a = text [ this . textBlob . Value . textOffset + i ] ;
194
195
int code = a ;
195
196
if ( char . IsHighSurrogate ( a ) ) {
196
- D . assert ( i + 1 < this . textBlob . textSize ) ;
197
- D . assert ( this . textBlob . textOffset + i + 1 < this . textBlob . text . Length ) ;
198
- char b = text [ this . textBlob . textOffset + i + 1 ] ;
197
+ D . assert ( i + 1 < this . textBlob . Value . textSize ) ;
198
+ D . assert ( this . textBlob . Value . textOffset + i + 1 < this . textBlob . Value . text . Length ) ;
199
+ char b = text [ this . textBlob . Value . textOffset + i + 1 ] ;
199
200
D . assert ( char . IsLowSurrogate ( b ) ) ;
200
201
code = char . ConvertToUtf32 ( a , b ) ;
201
202
}
@@ -205,7 +206,7 @@ public uiMeshMesh resolveMesh() {
205
206
206
207
var uvRect = EmojiUtils . getUVRect ( code ) ;
207
208
208
- var positionX = this . textBlob . getPositionX ( i ) ;
209
+ var positionX = this . textBlob . Value . getPositionX ( i ) ;
209
210
210
211
int baseIndex = vert . Count ;
211
212
vert . Add ( new Vector3 ( positionX + minX , minY , 0 ) ) ;
@@ -241,7 +242,7 @@ public uiMeshMesh resolveMesh() {
241
242
return this . _mesh ;
242
243
}
243
244
244
- var length = this . textBlob . textSize ;
245
+ var length = this . textBlob . Value . textSize ;
245
246
var fontSizeToLoad = Mathf . CeilToInt ( style . UnityFontSize * this . scale ) ;
246
247
247
248
var vertices = ObjectPool < uiList < Vector3 > > . alloc ( ) ;
@@ -254,9 +255,9 @@ public uiMeshMesh resolveMesh() {
254
255
uv . SetCapacity ( length * 4 ) ;
255
256
256
257
for ( int charIndex = 0 ; charIndex < length ; ++ charIndex ) {
257
- var ch = text [ charIndex + this . textBlob . textOffset ] ;
258
+ var ch = text [ charIndex + this . textBlob . Value . textOffset ] ;
258
259
// first char as origin for mesh position
259
- var positionX = this . textBlob . getPositionX ( charIndex ) ;
260
+ var positionX = this . textBlob . Value . getPositionX ( charIndex ) ;
260
261
if ( LayoutUtils . isWordSpace ( ch ) || LayoutUtils . isLineEndSpace ( ch ) || ch == '\t ' ) {
261
262
continue ;
262
263
}
0 commit comments