using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Scrollable : MonoBehaviour { public const float size = 35f; void Start() { var sizeY = -(transform.childCount-1) * (transform.GetChild(0).GetComponent().sizeDelta.y + GetComponent().spacing); Debug.Log(transform.parent.GetComponent().sizeDelta.y + " -- " + (-sizeY)); GetComponent().offsetMin = new Vector2(GetComponent().offsetMin.x, (transform.parent.GetComponent().sizeDelta.y > -sizeY ? 0 : sizeY + transform.parent.GetComponent().sizeDelta.y + GetComponent().spacing)); int i = 1; foreach(Transform child in transform) { if(i % 2 == 1) child.GetComponent().color = new Color(child.GetComponent().color.r, child.GetComponent().color.g, child.GetComponent().color.b, child.GetComponent().color.a / 2); i++; } } void Update() {} }