Skip to content

Commit 1ed548c

Browse files
committed
disable rawimage when text is empty hb
1 parent f433222 commit 1ed548c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

SkiaUnity/Assets/SkiaSharp/Runtime/HB_TEXTBlock.cs

+10
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ public TextAlignment TextAlignment{
295295

296296
void Awake() {
297297
rawImage = GetComponent<RawImage>();
298+
if (rawImage && String.IsNullOrEmpty(text)) {
299+
rawImage.enabled = false;
300+
}
298301
rectTransform = transform as RectTransform;
299302

300303
styleBoldItalic.FontSize = fontSize;
@@ -310,6 +313,7 @@ void Awake() {
310313
styleBoldItalic.Underline = underlineStyle;
311314
styleBoldItalic.LineHeight = lineHeight;
312315
styleBoldItalic.StrikeThrough = strikeThroughStyle;
316+
313317
}
314318

315319
private void OnEnable() {
@@ -338,6 +342,9 @@ public uint ColorToUint(Color color){
338342

339343

340344
private void RenderText() {
345+
if (rawImage && String.IsNullOrEmpty(text)) {
346+
rawImage.enabled = false;
347+
}
341348
Dispose();
342349
#if !UNITY_EDITOR
343350
DestroyImmediate(rawImage.texture);
@@ -458,6 +465,9 @@ private void RenderText() {
458465
texture.Compress(false);
459466
texture.Apply();
460467
rawImage.texture = texture;
468+
if (!rawImage.enabled) {
469+
rawImage.enabled = true;
470+
}
461471
Dispose();
462472
textRendered = true;
463473
}

SkiaUnity/Assets/SkiaSharp/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.ammariqais.skiaforunity",
33
"displayName": "Skia For Unity",
4-
"version": "3.0.5",
4+
"version": "3.0.6",
55
"unity": "2019.3",
66
"description": "Skia For Unity With Harfbuzz texts, Skottie Animations, lottie",
77
"author": {

0 commit comments

Comments
 (0)