но вместо ручной настройки размера я хочу установить его автоматически.
Код: Выделить всё
void CreateMarks()
{
RectTransform sliderRect = slider.GetComponent();
// Calculate the width of each step on the slider
float stepWidth = sliderRect.rect.width / (objectsToMove.Count + 1); // +1 to avoid overlapping at edges
for (int i = 1; i
Подробнее здесь: [url]https://stackoverflow.com/questions/79185986/how-to-calculate-the-prefab-scale-size-to-fit-automatic-to-a-ui-slider-height[/url]
Мобильная версия