I'm trying to figure out how to create code that will wait for ten seconds. My current code is below but something is causing a problem. I don't know if it is necessarily the loop but something in my function isn't working. My code is below.
using System.Collections;
using System.Collections.Generic;
using System.Timers;
using UnityEngine;
public float ImmunityTimer;
ImmunityTimer = 10;
while (ImmunityTimer > 0){
ImmunityTimer -= Time.deltaTime;
}
``` Let me know if there is a problem with this. I did cut some other code out but if this part looks fine then I'll try to check the other code.