How to add a delay in a C# unity script

I have these lines of code in an update function in a C# Unity script:

variable1 = VALUE;
[I want to add a delay here]
variable 2 = VALUE;

I have tried Thread.Sleep(milliseconds) and Waitforseconds(). But I have had no luck in making them work.

It would be greatly appreciated if anyone could show me a solution to this problem.

Thanks, Isaac

Leave a Comment