So I have an event trigger that when holding and dragging through the screen will increase the power bar. The thing is I need it to only drag downwards in order for the power bar to increase. Any solutions?
I think you need save your mouse position, then if current mouse position y lower than previous one, increase your power.
Here is an example :
float prevMouseY;
void OnDrag(){
var pos = Input.mousePosition;
if(prevMouseY == 0){
prevMouseY = pos.y;
return;
}
if(pos.y < prevMouseY){
//increase power code here.
}
prevMouseY = pos.y;
}