One thing you’re missing here, that causes your issues, is that OwnerActor
in EventReceiveExecute
is a Controller
not a Pawn
. So when you call destroy you don’t destroy the pawn on the level, you destroy his brain!
To get access to AnimInstance
of your AI you need a sequence of calls:
- cast
OwnerActor
to a controller - from the controller get the pawn with
GetControlledPawn
call - cast retrieved pawn to
Character
class - from resulting character instance get its skeletal mesh with
GetMesh
call - you can get
AnimInstance
from the mesh withGetAnimInstance
call
Cheers,
–mieszko