Я пытаюсь центрировать массив кнопок на полосе прокрутки, но только первый элемент меняет позицию, когда я нажимаю другие кнопки, только моя первая кнопка - это движение, любая идея?
public void CenterBets1()
{
Debug.Log("click");
for (int i = 0; i < bets.Count; i++)
{
if (bets[i].gameObject.tag == "ContainerTag" && bets[i].gameObject.name == "Container (1)" && bets[i].editorValue == 10)
{
Debug.Log("container click 1");
betContent.offsetMin = new Vector2( -(contentSize * (betContent.anchorMin.x + ((betContent.anchorMax.x - betContent.anchorMin.x) * 0.5f) * contentSize)), 0);
betContent.offsetMax = new Vector2(contentSize * (betContent.anchorMin.x + ((betContent.anchorMax.x - betContent.anchorMin.x) * 0.5f) * contentSize), 0);
Debug.Log("anchor max: " + betContent.anchorMax.x + " anchor min: " + betContent.anchorMin.x);
Debug.Log("offset max: " + betContent.offsetMax + " offset min: " + betContent.offsetMin);
}
}
}