So I am trying to use this code:
GetComponent<Renderer>().material.color = Color.red;
Thread.Sleep(500);
GetComponent<Renderer>().material.color = Color.white;
But when I do it, nothing happens; it appears, if I add a debug.log() it just prints it after 500ms even if the debug.log is before the thread.sleep, this also occurs with task.delay().
However, if I remove the Thread.Sleep or delay everything works normally color will change can confirm for the split second it changes in using debug.log.
So what is it about task.delay, or thread.sleep that causes the code near it not to run? And alternatively, is there a more efficient way to generate a wait before running the following line of code?