Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: callski on December 19, 2014, 11:43:55 AM

Title: Scroll View check if scrolling
Post by: callski on December 19, 2014, 11:43:55 AM
Hello Everyone!
     What is the best way to tell if a scroll panel has finished scrolling? I need to fire an event when the panel is not moving. Thank you for your time!
Title: Re: Scroll View check if scrolling
Post by: callski on December 19, 2014, 02:09:59 PM
So what I've done is created a script to see if the gameobject is moving or not. This is extremely inefficient but I need make sure the panel is not scrolling before I fire an event. Below is my script. I would appreciate any feedback if someone has a better way on telling if a panel is being scrolled.

<code>
using UnityEngine;
using System.Collections;

public class MovementCheck : MonoBehaviour
{
    public bool IsMoving;
    private float _lastY = 0;

    void Update()
    {
        if (transform.position.y != _lastY)
        {
            IsMoving = true;
            _lastY = transform.position.y;
        }
        else
        {
            IsMoving = false;
        }
    }
}
</code>
Title: Re: Scroll View check if scrolling
Post by: ArenMook on December 19, 2014, 06:20:30 PM
UIScrollView.onDragFinished
UIScrollview.onStoppedMoving