I'm having trouble with time in c#, I've created a stopwatch and I want the game to carry on for a set time period before stopping and assigning autoPlay to true. Instead what is happening is the game is stopping for the set time in Thread.Sleep - is there anything i can substitute this for, or a better way of doing this? code below.
void Timer()
{
    // Create new stopwatch.
    Stopwatch stopWatch = new Stopwatch();
    // Begin timing.
    stopWatch.Start();
    // Do something.
        Thread.Sleep(200);
    // Stop timing.
    stopWatch.Stop();
    autoPlay = true;
}
 
     
    