I’m trying to get an enemy to sense when a player character comes into sight, and at the moment am unable to get the PawnSensing component to register at all.
I’ve added the component to a Character, and also unchecked “Only Sense Players” as my game’s a RTS-style thing and so the player is controlling an invisible camera with their units represented as other Characters, I have also increased the Peripheral Vision Angle to make sure it wasn’t a problem with that.
What I’ve not been able to do is set “Parent Socket” to the socket I’ve created in the head of the skeleton, I’m unable to either type into the box or drag the PawnSensing component to be a child of the Mesh.
For an event graph I have the simplest thing I can imagine- simply print when you see something. Anything. But at the moment I’m taking my player-controlled units, bringing them round a wall, and running them round the enemy, all with no message being printed.
I think I’ve missed something obvious but can’t think what it is.
Is your enemy character inherit from an AIPawn Class?
It’s a Blueprint with “Character” as parent, I can’t see any AIPawn class to use here.
Sorry, I’m an idiot.
There is only AIController, no AIPawn.
Back to the topic, I can make it sense my character relatively easy, and print hello when it sense my presence.
You just have to make sure your controlled character is inherited from a Pawn or Character class, check it with blueprint properties.
Ah, it was the AIController.
Both Player and Enemy did inherit from Character, but the Enemy didn’t have an AIController associated with it- and I didn’t know it needed one for this as I thought they were for more complex control setups.
Thanks for the help, much appreciated.
So I am having the same issue with the OnSeePawn event. It just does not appear to be firing when my player character walks into the “look” zone. I’ve set the collision on the player to block all in every place i can think.
My bot controller is based off AIController, and my bot is a character BP with the AI set as the bot controller.
Bump: Needing help with this also.
You need to enable Pawnsensing with a “set sensing updates enabled” node (also make sure you enable the enable bolean in that node) in the construction BP for your AI controller.
Let me know if that helps
Hey everyone! I would like to offer the solution that worked for me.
In your pawn where you are trying to use the OnSeePawn event, make sure “Auto Posses AI” is set to “Placed in world or spawned”. Like so:
This worked, and Anonymous User worked too. Thanks both!