I think you are doing so in the correct way, comparing static-meshes and alike adds a layer of complexity that I’d personally avoid.
The code you posted looks to be syntactically correct, and a very-similar implementation works for me?
Assuming your IDE (such as visual studio) can do so, Might I suggest splitting the code into several lines and stepping through each line using the debugger to be certain you are getting what you expect.
ie: that returnRaycastActor() is returning the correct object, etc?