Why is GetActorOfClass failing if I leave some components' collision enabled, but succeeding if I disable those components' collision?

Here is the construction of my basic pawn, “BP_Flyer”. Notice the big white egg. That’s the “Sphere” you can see in the components list.

Over in a different blueprint, I use the node GetActorOfClass, and it looks for a BP_Flyer.

If I leave that egg’s collision default enabled, GetActorOfClass fails. But if I turn that egg’s collision off, GetActorOfClass works. More specifically, this prints “None” if the egg’s collision is enabled.

But succeeds by simply doing this:

The same thing occurs if I toggle the collision of the orange cone instead of the white egg.

So the question is: Why?

I’m suspecting the code you have before that node. What is there?

Try just getting the actor on begin play.

Found the problem: It was causing 2 colliders to intersect on startup.

The class “BP_Flyer” was the game’s default pawn class, and I had positioned PlayerStart to intersect the ground. This is desired; I don’t actually use any colliders on the player-character. This, coupled with the fact that my ground collider is built at runtime so there’s no editor-visible warning, would be why I didn’t notice the issue sooner.

But adding the sphere and forgetting to disable its collision led to the problem. While I did know that disabling collision was a fix, this was a case of needing to know why it was a fix.

Don’t let PlayerStart colliders intersect other colliders. I believe the Editor usually warns you when this is happening. Moving or disabling any of the offending colliders fixes the issue.

Thanks for the thought! But I finally did notice the issue. BP_Flyer was used by PlayerStart, and the added collider on the sphere (or cone) was leading to an intersection with another collider on startup, so Unreal was removing the PlayerStart pawn.

I hadn’t noticed sooner because I don’t actually use colliders on the character (intentionally). Adding the sphere’s collider was just a mistake and disabling it was all I needed, but I still needed to understand why that had caused issues.