Answer the question
In order to leave comments, you need to log in
How to loop once on the end of a timer in C#?
How to make the timer run only 1 time and after it ends, the loop is executed
(only 1 time)?
The code:
NetworkChat.sendAlert("Airdrop will fall to the Summerside Peninsule after 5 min!");
airdrop = new System.Timers.Timer(300000);
airdrop.Elapsed += AirdropElapsed;
while (AirdropElapsed.istrue == true)
{
NetworkChat.sendAlert("Airdop was fallen to Summerside Peninsula!");
Vector3 summerside = new Vector3(790, 24, -450);
int[] array2 = array;
foreach (int num in array2)
{
SpawnItems.spawnItem(num, 1, summerside);
}
NetworkChat.sendAlert(messageAfterDrop);
}
airdrop.Enabled = false;
Answer the question
In order to leave comments, you need to log in
Create a thread that will call the function 1 time, then sleep for an interval and call the function again. And no timer needed
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question