Author Topic: UIScrollView  (Read 198230 times)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIScrollView
« Reply #135 on: February 10, 2016, 05:55:02 PM »
When you center on words you center on the background? I am not quite sure I understand you. If you are centering on something, I expect you to center on that, not on something else. I suggest having a look at the 14th example that comes with NGUI covering endless scroll views. The middle scroll view, one with the green cells, has centering on children, and it works as expected when you go from 9 to 1.

chrisfirefox

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 9
    • View Profile
Re: UIScrollView
« Reply #136 on: February 12, 2016, 04:25:42 AM »
Reset Position controls where the scroll view ends up when its position is reset programmatically. This value is relative to the width and height of the content. The starting value (0, 0) means top left corner. If you wanted a centered reset point, you would specify (0.5, 0.5).
A little request for updated documentation, as far as I understood the code, the "Reset Position" Values has been replaced with "Content Origin", but the documentation (first post of this topic) still states that it is there.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIScrollView
« Reply #137 on: February 12, 2016, 08:52:22 PM »
Done, thanks.

guoyuquan

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: UIScrollView
« Reply #138 on: April 26, 2016, 10:00:07 AM »
Hi, I find that with the NGUI version 3.9.8, I cannot follow the tutorial video 4, in which the scroll view and add a sprite. I do all those that specified in the video, but I still cannot drag the sprite. What should I do.

guoyuquan

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: UIScrollView
« Reply #139 on: April 26, 2016, 10:08:06 AM »
got it. the reason is that the auto-adjust to match collider default set to disabled. And I didn't set the size of collider. sorry

ivan_omni

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Re: UIScrollView
« Reply #140 on: October 05, 2016, 07:44:53 AM »
I've made a build for android with the "Scroll View (Panel)" Example scene. In order to simulate a slow frame rate I've added:
  1. Application.targetFrameRate = 15;

In this scenario, the scroll view doesn't respond at all at fast drag gestures, remaining in the same position after the gesture. This only happens if the gesture is finished by stop pressing the screen (i.e., 1.-press 2.-drag 3.-stop pressing, all within 100~200ms).

This, as far as I understand, can potentially affect all games with frame rate problems.

Ideally, the scroll movement should be independent from frame-rate. Are there any plans to tackle this issue?

Thanks in advance!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIScrollView
« Reply #141 on: October 11, 2016, 10:57:39 AM »
The movement is framerate-independent, but events are not. You may run into a situation where you press and release in the same frame, or press and release without an adequate amount of movement in between of the frames. Off the top of my head not much can be done about that.

Dune

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: UIScrollView
« Reply #142 on: October 19, 2016, 02:03:43 PM »
Following Tutorial 4...

Couldn't right-click on the camera or background to do the create. Had to use the top-bar NGUI menu.

Then I had a hard time getting the resize dots to appear, but now that I have them I cannot drag and resize the ScrollView as seen in the tutorial. The size only resizes by 2 pixels for a long drag. Then another 2, etc.

Just deleted the ScrollView and created another, and it's working fine. Thought I'd report the strange behavior.

Dune

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: UIScrollView
« Reply #143 on: October 19, 2016, 02:15:19 PM »
Can't right click on any NGUI object to get the context menu as you do in your videos. And left click to select is very difficult. I have to click dozens of times to get it. I usually revert to using the hierarchy to select.

Dune

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: UIScrollView
« Reply #144 on: October 19, 2016, 03:22:12 PM »
Struggling with the tutorial. So many things go wrong. Here's some screenshots when I add the Grid, put the sprites in it and then click Execute.





Edit. Looking things over, the Grid has an XYZ scale of 205.5 and UI Root's XYZ scale of 0.004866, I'm sure that's messing with stuff. But I can't change the UI Root's scale to 1,1,1. They don't change from the 0.004866.
« Last Edit: October 19, 2016, 03:38:37 PM by Dune »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIScrollView
« Reply #145 on: October 19, 2016, 06:54:20 PM »
Press "T". That activates rect transform, like Unity's UI. You have the move transform selected. The scale on your sprite is way off too... 0.004866? It should be (1, 1, 1). Check the scales of your objects.

Dune

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: UIScrollView
« Reply #146 on: October 21, 2016, 12:20:34 AM »
It turns out I needed to adjust the grid's cell sizes, and re-execute. But yeah, the scales are strange. I started over with a new project.

I've managed to follow most of tutorial 4. All except for being able to drag onto the single square, at the 12 minute mark on YouTube. See my comment there -

https://www.youtube.com/watch?annotation_id=annotation_4134838683&feature=iv&src_vid=jDxWG81sNPc&v=UK3aMHRfgcw

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIScrollView
« Reply #147 on: October 24, 2016, 07:12:38 AM »
Youtube is probably the worst place to ask questions. Stick to the support forum here, I actually read and reply here. :) Best to use http://www.tasharen.com/forum/index.php?board=1.0 though.

BAIZOR

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: UIScrollView
« Reply #148 on: April 03, 2018, 12:34:58 PM »
UIScrollView extention

I created extentions for UIScrollView, it helps getting vertical and horizontal scroll percent [0 - 1]
Check the ExtentionsUIScrollView.cs here - https://gist.github.com/IvanMurzak/2bad3244b5dd6dec266ceae0eb25d960

It works super easy. Just put the class in your unity project than you can write this anywere:

  1. UIScrollView scrollView;
  2.  
  3. float percentH = scrollView.PercentHorizontal();
  4. float percentV = scrollView.PercentVertical();

ginxx009

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: UIScrollView
« Reply #149 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

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class NGUI_PageNavigation : MonoBehaviour {
  6.  
  7.     public GameObject sv;
  8.     public SpringPanel sp = null;
  9.     private const int xSpring = 1278;
  10.    
  11.  
  12.     // Use this for initialization
  13.     void Start()
  14.     {
  15.         sp = sv.GetComponent<SpringPanel>();
  16.         if (sp == null) sp = sv.AddComponent<SpringPanel>();
  17.        
  18.         sp.target.x = 0;
  19.         sp.target.y = 0;
  20.         sp.target.z = 0;
  21.     }
  22.  
  23.     public void LeftArrow()
  24.     {
  25.         if (sp.target.x >= 0)
  26.         {
  27.             sp.target = Vector3.zero;
  28.             sp.enabled = true;
  29.         }
  30.         else
  31.         {
  32.             sp.target = new Vector3(sp.target.x += xSpring, sp.target.y, sp.target.z);
  33.             sp.enabled = true;
  34.         }
  35.     }
  36.  
  37.     public void RightArrow()
  38.     {
  39.         sp.target = new Vector3(sp.target.x -= xSpring, sp.target.y, sp.target.z);
  40.         sp.enabled = true;
  41.     }
  42. }
  43.  
  44.  

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.