Movement using the Scrollbar

I’m pretty new in programming and I’m trying to figure out how to move a character using a scrollbar. I want to use a scrollbar because I want to make a Mobile game where players would move up and down by the position of their finger. Should I use a scrollbar to move a player for the phone or do I use UI buttons? If I use UI buttons how do I do that, since I do realize that buttons only activate something once?

You don’t need to have any GUI element to move the player up and down. Personally, I would opt for less elements on screen to have more space to see the action. If this sounds good, I would recommend just getting the touch position at the start of the gesture and the touch position in the middle of the gesture to make sure the touch is moving within your limits upwards or downwards and finally get the end position. If you want to move while the gesture is taking place you can check the touch position every frame and move based on the change from one frame to the other. I’d imagine you would want a float that checks to make sure the variance of the x axis position to ensure that the touch doesn’t slide to far horizontally from your start position. Finally you will have to change the position from screen space (where the touch is happening) to world space (where the objects move around) Unity - Scripting API: Camera.ScreenToWorldPoint

If you insist on using UI elements to do this, you will have to check to see if the element has been touched and then work your magic.

If all of this sounds foreign, I would suggest doing some tutorials on the subject as that will likely greatly improve your abilities.