Skip to content

Instantly share code, notes, and snippets.

View emredesu's full-sized avatar
💭
boo

emredesu

💭
boo
View GitHub Profile
@emredesu
emredesu / ScrollRectAutoScroll.cs
Last active January 4, 2024 05:49 — forked from mandarinx/ScrollRectAutoScroll.cs
Re-written for the new input system. Also uses unscaledDeltaTime for use in pause menus, and doesn't do anything if the platform is a mobile platform with no gamepads connected.
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using UnityEngine.InputSystem;
[RequireComponent(typeof(ScrollRect))]
public class ScrollRectAutoScroll : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler {
public float scrollSpeed = 10f;
private bool mouseOver = false;