S
S
Slava3212021-05-02 14:26:41
Unity
Slava321, 2021-05-02 14:26:41

How can I make a long press of a key in Unity to perform some action?

I have a script for buttons, in this script there should be a function PressButton (Action CallBack), which will be called in another script through a button: BtnE.PressButton(). PressButton should return CallBack when pressed, maybe I don't know CallBack.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
CHIDWI, 2021-05-02
@CHIDWI

For example, we do it tritely in the update through if getkey in it, we make a certain timer that keeps the timer ++ button for as long as it is and when a certain value is reached, we send a callback or do something there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question