Why get i this error? I know what the error means, but i dont know why i get this error.
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <9577ac7a62ef43179789031239ba8798>:0)
System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <9577ac7a62ef43179789031239ba8798>:0)
System.Collections.Generic.List1[T].get_Item (System.Int32 index) (at <9577ac7a62ef43179789031239ba8798>:0) GameManager+<>c__DisplayClass70_0.<Klondike_SetUpMatchfield>b__0 () (at Assets/Scripts/GameManager.cs:509) UnityEngine.Events.InvokableCall.Invoke () (at <e5b75411c8cd4bfaa9e760be20206f29>:0) UnityEngine.Events.UnityEvent.Invoke () (at <e5b75411c8cd4bfaa9e760be20206f29>:0) UnityEngine.UI.Button.Press () (at C:/Program Files/Unity/Hub/Editor/2019.4.13f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:68) UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2019.4.13f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:110) UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2019.4.13f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:50) UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction
1[T1] functor) (at C:/Program Files/Unity/Hub/Editor/2019.4.13f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:261)
UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/Unity/Hub/Editor/2019.4.13f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:377)
for (int i = 0; i < nachziehstapel.Count; i++)
{
nachziehstapel[i].SetCard(Instantiate(nachziehstapel[i].GetCard(), Matchfield.transform.Find("nachziehstapel").transform));
nachziehstapel[i].SetBackside(Instantiate(nachziehstapel[i].GetBackside(), Matchfield.transform.Find("nachziehstapel").transform));
nachziehstapel[i].GetBackside().GetComponent<Button>().onClick.AddListener(delegate { Klondike_Nachziehstapel_OpenCard(nachziehstapel[i].GetBackside()); });
nachziehstapel[i].GetBackside().transform.localScale = new Vector2(0.15f, 0.15f);
nachziehstapel[i].GetCard().transform.localScale = new Vector2(0.15f, 0.15f);
nachziehstapel[i].GetCard().SetActive(false);
nachziehstapel[i].GetBackside().SetActive(false);
nachziehstapel[i].GetCard().transform.localPosition = new Vector2(klondike_nachziehstapel_x, klondike_nachziehstapel_y);
nachziehstapel[i].GetBackside().transform.localPosition = new Vector2(klondike_nachziehstapel_x, klondike_nachziehstapel_y);
}