Download

Why is my timer Parameter never updating?

I’m trying to create a loop that runs through an array. Each item in the array I want to set a timer. The function the timer calls has a couple parameters. A reference to the array, an actor reference, and an index number. The index number is the same as the current loop iteration. This number doesn’t appear to update though. Below is the code


FTimerDelegate TimerDel;
	int32 IDX = 0;
	TimerDel.BindUFunction(this, FName("ProcessOneCellDestruction"), subCells, IDX, listActor);
	float sliceOfTime = 1.0 / numSCs;
	float currentTime = sliceOfTime;
	for (; IDX < numSCs;)
	{
		currentTime += sliceOfTime;
		IDX++;
		FTimerHandle TimerHandle;
		GetWorldTimerManager().SetTimer(TimerHandle, TimerDel, currentTime, false);
	}