Skip to content

Commit 667ea92

Browse files
committed
[修复]1. 修复Visable 的时候gameObject 报错的问题
1 parent ebb5577 commit 667ea92

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Runtime/Core/DisplayObject.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,11 @@ public bool visible
303303

304304
if (parent != null && _visible)
305305
{
306-
gameObject.SetActive(true);
306+
if (gameObject.activeSelf == false)
307+
{
308+
gameObject.SetActive(true);
309+
}
310+
307311
InvalidateBatchingState();
308312
if (this is Container)
309313
{
@@ -312,7 +316,10 @@ public bool visible
312316
}
313317
else
314318
{
315-
gameObject.SetActive(false);
319+
if (gameObject.activeSelf)
320+
{
321+
gameObject.SetActive(false);
322+
}
316323
}
317324
}
318325
}

0 commit comments

Comments
 (0)