Whenever I do “yield return new WaitForSeconds(5);” It gives me an error stating ‘WaitForSeconds’ does not contain a constructor that takes 1 arguments. I can’t find a similar time this has happened before on any forum, at least in the same way, from where I looked, and it doesn’t make sense as I don’t know what exactly that means? And or why it’s appearing, because even according to the documentation for 2022.3, this is how your meant to do a WaitForSeconds. Is there something I did wrong?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class testingThing : MonoBehaviour, IInteractable
{
public Animator animator;
public void Interact()
{
Debug.Log(Random.Range(0, 100));
FadeToLevel(1);
}
public void FadeToLevel (int levelIndex)
{
animator.Play("Crossfade_Start");
StartCoroutine(YourName());
}
IEnumerator YourName()
{
yield return new WaitForSeconds(5);
Debug.Log("Finished waiting!");
SceneManager.LoadScene("LevelOne");
}
}