Here is the scenario when I got this issue:
I’m currently implementing the attack animation and hit detection for enemy actors.
At the end of an attack ends, the enemy have to do two things:
1.Set attack animation to unplayable, which can easily done in the animation BP.
2.Clean some of the member variable value in enemy class, which can be done, in my thought, in 2 ways:
a: call clearvariables() function in animation BP, them implement this function in C++ (this is my current solution)
b.trigger an animation end notify in animation BP, catch the event and process it in C++ enemy class
I think that the second solution is better, since I can keep it from messing animation BP graph, and keep the
function call in C++ class. The question is, I have no idea how to do it.
If anyone knows how to do it, or even have a better solution for it, I will appreciate your help.
For fature referance if anyone would need it.
I do it right now this way:
Crating a BP variable to get the notify from animation.
Create “new notify” with whatever name.
In Animation BP in event graph get the enemy and set created earlier variable to some value on notify- event name.
In Tick function check variable and do some stuff
void MyEnemy::Tick(float deltaTime)
I know I can communicating between ABP and character C++ class by a variable.
But I still wanna know if I should use it, or any better solution for it.
Got the answer by myself anyway. Here’s the solution:
for( TArray::TIterator it =
GetMesh()->AnimScriptInstance->AnimNotifies.CreateIterator(); it; ++it )
GEngine->AddOnScreenDebugMessage( -1, 15.0f, FColor::Red, (*it)->NotifyName.ToString() );
you can use the NofifyName attribute to do the necessary operation you want.
Thank your question and answer, this helps me.