private void DespawnPanel(IHSUIComponent p) { //先回收panel所有包含的widget for (int i = _panelWidgets.Count - 1; i >= 0; i--) { var c = _panelWidgets[i]; if (c.parent == p) { c.widget.OnDespawn(); _provider.Despawn(c.widget); _panelWidgets.RemoveAt(i); } } //再回收panel p.OnDespawn(); _provider.Despawn(p); }