-3

I need to add a delay to some JavaScript code without importing anything. How do I do it?

I need this for a unity project I am working on. It's like Minecraft but better and I need to add block break times. I have had a look on other websites but got nothing.

I want the code to wait the delay time before proceeding on to the next task. I am quite new to JavaScript too.

1 Answers1

0

Use setTimeout function. It expects two methods. The first is a callback function that executes after a set time. The second is the number of milliseconds before executing the callback function in the first parameter.

More info https://www.w3schools.com/jsref/met_win_settimeout.asp

David Grace
  • 141
  • 4