Why does my timers argument not change?

I have a timer that gets called, it provides an array reference, an index, and and actor reference. Both the array reference and the actor reference appear to be fine, but the index never updates. 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;
		FTimerHandle TimerHandle;
		GetWorldTimerManager().SetTimer(TimerHandle, TimerDel, currentTime, false);

To fully understand the problem i would need to know what types you use on arguments of ProcessOneCellDestruction, but here what i think is the problem

Moment of calling BindUFunction is the moment when argument is binded and will be sent as it is at this moment, IDX is 0, so delegate will always send 0. So move FTimerDelegate TimerDel; and TimerDel.BindUFunction(this, FName("ProcessOneCellDestruction"), subCells, IDX, listActor); to the loop so each timer will have different delegate with different argument set.

Awesome, that worked. Thank!

I have a couple questions about this. How much of the parameters is copied and does any of it remain a reference? I was able to get this working by doing what you said and moving the delegate declaration into the loop. Is it possible for me to only bind the delegate once, and provide a reference to a USTRUCT which houses the needed parameters? Essentially I’d like to update the IDX number, but it appears to never update, unless I specifically bind on each loop