Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: elvess on August 28, 2014, 02:57:26 AM
-
Hello. I have a group of UIToggle. This is 5 separate UIToggles and 1 - Check All Toggle. When I check Check All Toggle it should do something like:
foreach (PlayerItem item in m_PlayersList)
{
if (!item.IsChecked)
item.SelectPlayerToggle.value = true;
}
There is OnValueChange event on item.SelectPlayerToggle. But I receive an error on the first iteration
Object reference not set to an instance of an object UIToggledObjects.Toggle () (at Assets/NGUI/Scripts/Interaction/UIToggledObjects.cs:49) - bool val = UIToggle.current.value;
Is there a way to do this by code?
Thank U
-
How are you getting the UIToggledObjects.Toggle to trigger with UIToggle.current being null? That function is called by UIToggle's onChange notification, which is wrapped inside "current = this" section. What version of NGUI are you using?