Hi, could somebody help me? I’m adding a pickup that provides a shield for the player for 5 secs. I’ve written a Coroutine but no code after the yield return seems to be working:
IEnumerator Shielded()
{
playerScript.shielded = true;
if (playerScript.shielded == true)
{
Debug.Log(“Shield On!!”);
}
yield return new WaitForSeconds(5f);
Debug.Log(“Waiting”);
playerScript.shielded = false;
if (playerScript.shielded == false)
{
Debug.Log(“Shield Off!!”);
}
}
I have no idea why it’s not working since it seems to be pretty straightforward