Hi there,
Some time I'm getting a NullReferenceException at UIToggle.Set - UIToogle.cs:249 line, for example:
NullReferenceException: Object reference not set to an instance of an object
UIToggle.Set (Boolean state) (at Assets/Common/ThirdParty/NGUI/Scripts/Interaction/UIToggle.cs:249)
UIToggle.set_value (Boolean value) (at Assets/Common/ThirdParty/NGUI/Scripts/Interaction/UIToggle.cs:98)
ActivityController.Reset (Boolean show) (at Assets/Game/Scripts/ActivityController.cs:121)
GameStateController+<Reset>c__Iterator44.MoveNext () (at Assets/Game/Scripts/GameStateController.cs:267)
The reson for that is from code below
aa @ UIToogle.cs:249 line can be null some time
...
// Play the checkmark animation
if (activeAnimation != null)
{
ActiveAnimation aa = ActiveAnimation.Play(activeAnimation, null,
state ? Direction.Forward : Direction.Reverse,
EnableCondition.IgnoreDisabledState,
DisableCondition.DoNotDisable);
if (instantTween || !NGUITools.GetActive(this)) aa.Finish(); /// <===== aa is null causing NullReferenceException
}
...
so fix is simple:
...
// Play the checkmark animation
if (activeAnimation != null)
{
ActiveAnimation aa = ActiveAnimation.Play(activeAnimation, null,
state ? Direction.Forward : Direction.Reverse,
EnableCondition.IgnoreDisabledState,
DisableCondition.DoNotDisable);
if (aa != null && ( instantTween || !NGUITools.GetActive(this))) aa.Finish(); /// <=== added null check for aa
}
...