public void HideWindowElement <T1, T2>() where T1 : UiWindow where T2 : UiElement { T1 window = GetWindowFromList <T1>(); T2 element = window.GetWidget <T2>(); if (element) { element.HideRecursively(); } }