- Home /
How to get a float of the times 1 scrolled?
Hello,
I need this time a way to detect how much i scroll.
If I scroll 3 times down then scroll = -3 if i than scroll 4 times up then scroll = 1 how can i do that?
again thanks!
Can you give us some more info, are you using the New 4.6 UI or OnGUI?
Also if you have some code can you post that, it'll make answering easier.
Thanks
@$$anonymous$$mmpies I have no code I know to dectect scrolling but i want to know howmuch the player has scrolled down and howmuch up
O$$anonymous$$ you still haven't said if you're using OnGUI or 4.6 but I'll just show you the 4.6 way.
If you have a scrollRect then you can just check the verticalNormalizedPosition (or horizontalNormalizedPosition if using horizontal scroll bars). That value is always between 0 and 1 no matter how big the content is.
public ScrollRect myScrollRect
void Update(){
Debug.Log("scroll position = "myScrollRect.verticalNormalizedPosition);
}
Un tested code so there may be typos!
EDIT
Sorry @rick grendel I don't think I can help you then. Converted my answer to a comment. Perhaps you could say which version you use to help people know how to answer.
Sorry, I not use either of them. I use an old version of unity.
Your answer
Follow this Question
Related Questions
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Javascript int to float 1 Answer
Get integer or float value of a variable 2 Answers
Error: "ArgumentException: get_deltaTime can only be called from the main thread" 1 Answer
BCE0019: 'distanceScore' is not a member of 'float'. (JavaScript) 3 Answers