Can you create a static function that gets all actors of a class?

I have a function that I want to be static, and it’s based around returning all actors of a class in a level. The problem is that the function GetAllActorsOfClass() requires a world context object. If the function is static, I can’t use “this” as the object, and I’m not sure how GetWorld() works, but it doesn’t let me call that either. Does anyone know a solution to this?

Thanks in advance!

Similar to that function that you’re trying to call, you would need a parameter passed in to act as the World context for that ‘Get’.

That’s a good idea, thanks!