Why output argument instead of return value for GetOverlappingActors

I am wondering why methods like GetOverlappingActors have a void return value and instead utilize references as output parameters to provide their results?

It makes sense when the method needs to provide multiple return values, but in this case there’s only a single value that the method “returns” (via output parameters).

It should be possible to change the method signature to just return the TArray of AActor pointers I assume and just take the single filter argument? Or am I missing something?

I want to make sure I understand the reasoning here to get a better handle of the rest of the Unreal API but also to have best practices for my own methods that I will be writing.

Thanks!

Privacy & Terms