Question by
gmod622 · Aug 15, 2016 at 06:14 PM ·
yieldwaitforsecondsyield waitforseconds
WaitForSeconds clarification
Hey! So i need some help with the function WaitForSeconds, how does it work? If i do somthing like this:
yield return new WaitForSeconds(1.5F);
//waits 1.5 seconds
debug.log("1");
yield return new WaitforSeconds(1.5F);
//waits 1.5 seconds
debug.log("2");
//both these functions run at the same time?
So does this mean waitforseconds waits for the code below it until it intercepts another waitforseconds?
Sorry if this doesnt make since, hopefully youll understand
Comment
Answer by LLIV · Aug 15, 2016 at 06:47 PM
That sounds about right. The wait function should effectively pause the script for the given number of seconds and then move on to whatever is below it. If you're wondering why it's not exactly 1.5 seconds or something like that WaitForSeconds is affected by timescale. If you want to make sure it's exactly 1.5 seconds use WaitforSecondsRealtime.