Latent Action Pitfalls

Can you tell what’s wrong with this blueprint graph? (hint: it’s very broken if you call it more than once). I could tell you a long story on how to fix it - but I’ve actually already done that several years ago.

Ok, the answer is that the event parameter “Url” is overwritten each time the event is triggered - hence when the latent action completes it will use the wrong key for the image cache. Although they are called event parameters in the ui and they look like parameters - they actually are not. Instead they are per object instance variables. Beware.

I have exactly the same issue.
If DownloadImage would have a context object as both input and output it would be much easier. Plus the url parameter :slight_smile:

I managed to do it without any code involved:

  1. Create a new object blueprint
  2. Add the url, context (pointer to caller) as variables
  3. Call DownloadImage from there.
  4. In the async OnSuccess or OnFailure delegate pins, call an event dispatcher with the url and context variables.

All Done!