0

In the documentation it says that ScrollRect has a velocity variable. (http://docs.unity3d.com/460/Documentation/ScriptReference/UI.ScrollRect.html)

But if I try to tap into it or output it to the console using the following code

 Debug.Log("Velocity: " + scroll.velocity.ToString());

the only output I get is

 Velocity: (0.0, 0.0)
 UnityEngine.Debug:Log(Object)

Has anyone managed to get a value from this variable? Any advice on what I might be doing wrong? Thanks in advance for any help.

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
kai Taylor
  • 785
  • 1
  • 7
  • 21
  • Do you get different output when you scroll the content of the ScrollRect? – David Reeve Feb 12 '15 at 14:53
  • No I get the vector (0.0,0.0) no matter how much I move the ScrollRect? The Debug.Log is in a fixed update function, by the way. – kai Taylor Feb 12 '15 at 15:07
  • Is there enough content in the ScrollRect such that it can scroll? i.e. does the content of the ScrollRect overflow? – David Reeve Feb 12 '15 at 15:08
  • Yes the scrollRect functions brilliantly, it scrolls a panel three times it's width left and right. But the velocity doesn't return anything? I am just trying to get the speed and direction of the scrollRect to trigger events. – kai Taylor Feb 12 '15 at 15:10
  • It appears that `velocity` is not implemented properly, though the only reference to this I can find is [this forum post](http://forum.unity3d.com/threads/infinite-scroll-with-scrollrect.265345/#post-1754337). Perhaps they have not yet exposed it. What version of Unity are you using? – David Reeve Feb 12 '15 at 15:14
  • I'm currently using Unity 4.2.6f1. So you think this is a bug, that is awaiting fixture in 5? – kai Taylor Feb 12 '15 at 15:27
  • I think so. The post I linked is from August, so it'd be my bet that this was fixed in 5, if at all. – David Reeve Feb 12 '15 at 15:38

0 Answers0