I am currently writing a programm in c#, for which I need something simular to the Update method in the Unity Engine. Basically a loop that executes a given code, over and over again, at a given tick rate. To re-create this functionality I was planing on just using a while (true)
loop and somehow run it without holding up the rest of my thread. Is there any way to do this? My current approach looks like this.
public void Update(int tickrate)
{
while (true)
{
foreach (IAgent agent in Agents)
{
agent.Move();
}
Task.Delay(tickrate / 60);
}
}