- Home /
Alternative to "yield return WaitForSeconds()" in Coroutine with .NET Framework (Unity 2018.4)
Hi everyone !
I'm trying to separate the "logic" part of my PONG game appart from the "Unity" part.
Originaly, I intended to make the scores displayed for 1 seconds with this DisplayScores function :
private IEnumerator DisplayScores(float delay)
{
playerScoresPresentation.Display(true);
yield return new WaitForSeconds(delay);
playerScoresPresentation.Display(false);
}
But now, I'm trying to get rid of the WaitForSeconds instruction and avoid the use of UnityEngine but I can't find any convenient solutions.
I tried to use Thread.Sleep() and Threading.Timer() but it seems I lack of some deep understanding of the yield and coroutines mechanism as well as the .NET Framework.
How can I use the .NET framework to replace the yiel return WaitForSeconds() instruction ?
Thank you all for your time !
Your answer
Follow this Question
Related Questions
Getting an error when trying to yield 2 Answers
Coroutine sequence not running properly 1 Answer
yield works, but yield WaitForSeconds does not? 1 Answer
WaitForSeconds problem with Unity Pro 3 Answers
Wait For Seconds to Load level C# 2 Answers