public void ShowSelectionPanel(UISelectionPanelType type) { HideUIPanel(); switch (type) { case UISelectionPanelType.Character: var temp = Instantiate(_selectionPanel); temp.transform.SetParent(_canvas.transform, false); SelectionPanel newPanel = temp.GetComponent <SelectionPanel>(); newPanel.InitPanel(type); UpdateCurrentPanel(newPanel.gameObject); break; } }