1
NGUI 3 Documentation / Re: UIScrollView
« on: June 26, 2018, 10:32:00 PM »
Hello guys I just wanted help for this. I created a 2 buttons (left and right) for scrolling to the next page. It's like a pagination thing .
Here's what I've got so far
What my problem is the VOID RIGHT ARROW
It exceeds even without object it still go endlessly. How can I stop that if the next page doesn't have an item it will springback to the last position.
Here's what I've got so far
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class NGUI_PageNavigation : MonoBehaviour {
- public GameObject sv;
- public SpringPanel sp = null;
- private const int xSpring = 1278;
- // Use this for initialization
- void Start()
- {
- sp = sv.GetComponent<SpringPanel>();
- if (sp == null) sp = sv.AddComponent<SpringPanel>();
- sp.target.x = 0;
- sp.target.y = 0;
- sp.target.z = 0;
- }
- public void LeftArrow()
- {
- if (sp.target.x >= 0)
- {
- sp.target = Vector3.zero;
- sp.enabled = true;
- }
- else
- {
- sp.enabled = true;
- }
- }
- public void RightArrow()
- {
- sp.enabled = true;
- }
- }
What my problem is the VOID RIGHT ARROW
It exceeds even without object it still go endlessly. How can I stop that if the next page doesn't have an item it will springback to the last position.
