Jump to content

How do I delay the execution of any method


photo

Recommended Posts

Posted

How do I delay the execution of any method? So that when I called some method, it would not be executed immediately, but after n time.

Posted

Use Spin Locks.

Rohit

  • 8 months later...
Posted
On 4/4/2022 at 11:36 PM, Tessalator said:
await Task.Delay(1000); //1 sec.

Hello, hate to be a bother but Unigine tells me that 'Task' doesn't exist in the current context (been trying for ages to find a debounce method).

Posted (edited)

Do you have a reference to System.Threading?

I don't know that Tasks (used like above) would be good for things like debounce. You could be spinning up a lot of threads.
Rohit's Spin Locks, etc. are lower level and better suited.

Edited by Tessalator
×
×
  • Create New...