Tz2/Assets/GameAssets/UI/ECP/Script/ScrollViewUpdate.cs

25 lines
567 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ScrollViewUpdate : MonoBehaviour
{
private ScrollRect scrollbar;
private VerticalLayoutGroup verticalLayoutGroup;
void Start()
{
scrollbar = GetComponent<ScrollRect>();
verticalLayoutGroup = GetComponent<VerticalLayoutGroup>();
}
public void UpdateScroll()
{
LayoutRebuilder.ForceRebuildLayoutImmediate(scrollbar.content);
}
private void FixedUpdate()
{
UpdateScroll();
}
}