/// <summary> /// Widget destructor /// </summary> protected virtual void Destruct() { // remove all event subscriptions m_list.OnSelectItem.RemoveListener(this.OnItemSelected); this.EnablePushButtonListener(false); // destroy the list and the selected item widget m_listAllocator.Destroy(m_list); if (m_selectedWidget != null) { m_allocator.Destroy(m_selectedWidget); } }
protected void RemoveWidgetAt(int p_index) { WidgetType widget = m_widgets[p_index]; if (widget != null) { Button button = widget.GetComponent <Button>(); if (button != null) { button.onClick.RemoveAllListeners(); } m_allocator.Destroy(widget); m_widgets[p_index] = null; } }