I have a function in my script that calls 5 commands, like this:
public class ScrambleScript : MonoBehaviour {
public RRotation ScrambleR; // reference for R rotation
public LRotation ScrambleL; // reference for L rotation
public FRotation ScrambleF; // reference for F rotation
public DRotation ScrambleD; // reference for D rotation
public Rotation ScrambleU; // reference for U rotation
void ScrambleCube() {
ScrambleR.ScrambleRNotation();
ScrambleU.ScrambleUNotation();
ScrambleL.ScrambleLNotation();
ScrambleF.ScrambleFNotation();
ScrambleD.ScrambleDNotation();
}
}
Once I call this function in the Update()
, the commands will be called every frame, however I want to be able to make another delay function that I can use to have a 1 second pause in between each function call, so it would look something like this:
void ScrambleCube() {
ScrambleR.ScrambleRNotation();
// waits 1 second here.
ScrambleU.ScrambleUNotation();
// waits 1 second here.
ScrambleL.ScrambleLNotation();
// waits 1 second here.
ScrambleF.ScrambleFNotation();
// waits 1 second here.
ScrambleD.ScrambleDNotation();
}
I have tried using the IEnumerator
function but I can't seem to get that to work if I paste the delay in between each function call as I've shown above. Is there another way to do this? Or was I using the IEnumerator
incorrectly?