Hi I have this simple custom button script that worked fine before 2019.3b10:
public class ButtonCustom : Button
{
public const string clickSE = "Common_UIright";
protected override void OnEnable()
{
base.OnEnable();
onClick.AddListener(delegate { PlayButtonSE(); });
}
protected override void OnDisable()
{
base.OnDisable();
onClick.RemoveListener(delegate { PlayButtonSE(); });
}
protected virtual void PlayButtonSE()
{
if (Application.isPlaying)
AudioManager.Instance.PlaySE(clickSE, UIManager.Instance.GetPhoneUI());
}
}
now it throws following error on runtime:
IndexOutOfRangeException: Index was outside the bounds of the array.
UnityEngine.UI.Selectable.OnDisable () (at C:/Program Files/Unity/Hub/Editor/2019.3.0b10/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Selectable.cs:521)
ButtonCustom.OnDisable () (at Assets/Scripts/UI/Button/ButtonCustom.cs:22)
UnityEngine.GameObject:SetActive(Boolean)
UIScene:SetVisible(Boolean) (at Assets/Scripts/UI/UIScene.cs:14)
…
I suspect it has something to do with the fix of issue 1160054 about disabled selectable items in 2019.3b10.