Z
Z
Zefirot2021-06-15 10:13:41
Unity
Zefirot, 2021-06-15 10:13:41

How to make an addition at different speeds?

I have buttons (like a picture with an Event Trigger) + - , I need to have + - 1 when I click, and if you hold + - it will quickly add or subtract ...
I tried to put on Event Trigger click, then one by one was added and subtracted, set Down, it still only counted once, I think you need to go through the update, but I also tried it, that is, set the start of pressing Down and then stop counting when Up, but there is a small problem - it immediately counts at a fast speed, but I need to it was considered if, for example, the button was held for more than a second ...
How can I do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Kachan, 2021-06-15
@Zefirot

You set the isPressed flag on down and plus on the update until you remove the flag on Up. You may need to add an additional timer first, as during one update, not everyone can finish the click.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question