Skip to content

Commit 3946db1

Browse files
committed
优化Motion Button OnDestroy
1 parent e6d6e67 commit 3946db1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Assets/Scripts/Live2D/DynamicFadeMotionSetup.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ private Button CreateMotionButton(string groupName, int index, bool isLoop, stri
243243

244244
private void ClearButtons()
245245
{
246+
buttonsByGroup?.Clear();
247+
248+
if (motionScrollRect == null) return;
246249

247250
foreach (Transform child in motionScrollRect.content.transform)
248251
{
@@ -254,7 +257,6 @@ private void ClearButtons()
254257
Destroy(child.gameObject);
255258
}
256259

257-
buttonsByGroup?.Clear();
258260
}
259261
#endregion
260262
}

0 commit comments

Comments
 (0)