HeavenStudioPlus/Assets/Plugins/com.unity.uiextensions/Runtime/Scripts/Utilities/ScrollRectExtensions.cs

17 lines
531 B
C#
Raw Normal View History

2022-01-06 00:11:33 +00:00
/// Credit Feaver1968
/// Sourced from - http://forum.unity3d.com/threads/scroll-to-the-bottom-of-a-scrollrect-in-code.310919/
namespace UnityEngine.UI.Extensions
{
public static class ScrollRectExtensions
{
public static void ScrollToTop(this ScrollRect scrollRect)
{
scrollRect.normalizedPosition = new Vector2(0, 1);
}
public static void ScrollToBottom(this ScrollRect scrollRect)
{
scrollRect.normalizedPosition = new Vector2(0, 0);
}
}
}