MulticastDelegate - First call returns last calls results

Hello all.

I am using a dynamic multicast delegate with a UTexture2D as an output. When I spawn a UMG it downloads a texture and when its done it calls the delegate. For now it always fails due to PIE…so I am picking a random image from an array.

So, when I spawn two widgets and their bound functions get called, it does choose a random image but the 1st widget always gets the 2nd widgets result.

The way I am firing the delegate is by using AddDynamic in the spawned widgets just before I call the download function. It seems when I use AddDynamic, it’s overriding the other spawned widgets delegates…

Is this normal? And if so, how should I be adding the delegate?

Thanks,

EDIT: The download function is Asynchronous so it must wait…when the delegate gets called is it calling the newest bound delegate? It’s very strange to me

for every new widget I create this is called on the GameInstance.

GI->OnAvatarDownloadedFinishedDelegate.AddDynamic(this, &UPlayerBar::OnAvatarDownloaded);

and the OnAvatarDownloaded chooses a random image. Printing the image name always ends up being the last spawned widgets image name. Not it’s own.

Had to unbind the delegate on the widget in OnAvatarDownloaded().