I have a function in C# which is executed from another script (once).
I want to pause the for loop in that function for a second each time it loops.
I don’t use any updates in my code.
public void ExplodeAll ()
{
for (int x = 0; x < width; x++)
{
for (int y = 0; y < height; y++)
{
if (test[x, y].GetComponentInChildren<Blokje> ().isMine)
{
test[x, y].GetComponentInChildren<Blokje> ().Explode ();
}
}
}
Win ();
}
I want to explode the cubes (blokje) after each other instead of all at once.
thanks apples, i saw that in another topic where you posted some example code. but i don’t know how to implement it in my code. could you give me a start?
I don’t use a update only some methods like the above one.
of course i tried that. The problem is that i don’t know how to pause that for loop. for example. i have a button that executes a for loop which prints a text to the debug log 10 times.
I want to wait a second between a loop. Which code and which functions do i have to add to my code?
Nope. You did the right thing, asked the right question and i helped. And actually i deal with co-routines and C# recently and i realized co-routines really work very differently in js and in c#. Have fun.