- Home /
Question by
Petr-Vejchoda · Jan 26, 2016 at 12:28 PM ·
methodsdelegates
Cannot cast Method group to UnityAction
void Close()
{}
void CloseImmediately()
{}
UnityAction h = m_CloseChildViews ? (UnityAction)CloseImmediately : (UnityAction)Close; //Unnecessarily long
UnityAction h1 = m_CloseChildViews ? CloseImmediately : Close; //Error here
if (m_CloseChildViews == true)
{
CloseButton.onClick.AddListener(CloseImmediately);
}
else
{
CloseButton.onClick.AddListener(Close);
}
Is there anything you can do about this??
Comment