Get All Actors Of Class within Function Library doesn't find any actors

I’m using Cast to node in one of my functions within a Function Library. The function is a custom Print String for debugging purposes.

For some reason the Get All Actors Of Class node returns no actors and therefore the value of the Debug Display Duration never gets read. One BP_DialogueManager class actor that I’m casting to exists in the level. Up until recently it was working fine. The funny thing is that now sometimes it works and sometimes it doesn’t.

The issue emerged before I upgraded my project from 4.16 to 4.17 and it is present in the 4.17 version as well.

I have a backup of my project from few days ago and the same logic works just fine in there.

Any suggestion whether it is a bug or something that I’ve missed on my part is welcome.

You can try manually providing it with a World Context see if that helps, make a new actor input and wire that to the world context, and when you call the function plug a reference to self in.

Thank you for the suggestion. Passing the calling BP refrence to the World Context works. Is this how it’s supposed to work with Function Libraries?

Just the weird think is that it’s been working for me without any reference for almost 2 months (on 4.16).

I don’t think the cast to node is necessary. Try removing it. The GetAllActorsOfClass node has a drop down where you can simply choose the class of object that you wish to get.

Thank you, I just learned something new. However, from the function behaviour point of view it didn’t make any difference.

For now I’m adding the references to the calling actors and passing them to the function. With some 200 points of call it’s just too much work.

With the 4.17.2 update the problem has been eliminated. Everything works fine without the need to provide the World Context.