I have a question about anim notify state. I have seen that there is a lot of people talking about this, but I haven’t found any valid solution.
My problem is :
In my player attack montage, there is an anim notify state. When the notify begin, I perform a trace (using multiline) and when the notify end, I stop the trace.
This anim notify is called twice (if I add a print string in it, I can see it clearly). For this reason, damage are also executed twice…
I have exactly the same issue with my AI attack montage.
I have found some solution (adding booleans to know if an anim notify is already open, or even add a do once on the trace event that is reset only when the trace stop).
But I found this really strange that it is fire twice, could you explain me why ? Does it mean all my notifies will be fire twice ? Because I have seen that my sound or FX notify are only fire once (so everything is normal for them).
Some information :
the blend in and blend out of my montage have a really small time. The notify begin really after the end of the blend in and end after the beginning of blend out for sure.
Has Autority node don’t exist in ANS. I have a server and more than 1 client so it can’t be the reason unfortunately.
Another information that can help :
I have a ‘has authority’ node that is in the event of the character called by the ANS (for my own reason, I use the remote pin of the node). And this event is called twice on the client (since the ANS is called twice, the event is called twice too. With a print into this event, I can see clearly that client 1 run twice this event).
Ok, I am using blend per bone for the character So, you think that is is created this issue ? I blend per bones for the top and bottom body. Does it mean that ANS is executed twice due to top and bottom ?
EDIT : ok, you are right. I just test it on an attack that is on the fullbody and this time I receive only one ANS. So you have found the problem. Thank you very much !!
And now… Do you know how to resolve it ?
I think there is no way to prevent this issue ? No other way than adding boolean to be sure that swing is not executing twice ?
If you’re using the animation that calls the notify both for upper and lower body, than yes, they are considered different instances of animation and each will call the notify.
I simply used this setup to mitigate it:
DoOnce and reset when you think necessary, maybe by another notify at the end of the animation.
Unfortunately, I can’t do that in anim notify state, because in this the begin and end are functions. The only thing I can do is do the do once as you showed but inside the event call by the begin, or create a variable boolean to know if the ANS is executed (but I don’t like this solution…).
I think there is no other way than doing a do once on the event execute by ANS, and reset it as soon the swing should end.
Thank you a lot for your help and time !
EDIT : I think there is no way in the anim graph to disable the notify for a pose ?
Conceptually DoOnce and setting a bool to true and false is the same thing, in C++ having bool is the only way. Blueprints just allow doing that without creating an explicit variable.
Or you can duplicate your animation and remove the notify in one of them, and use it for the lower body =) But it will increase the volume of files and maybe slightly decrease performance, but I’m not sure about the latter.
Yes it is the same, but I mean using a bool inside the ANS and using a do once inside the swing is not the same.
In the first case, if I use a bool inside the ANS, for example a bool named “isExecutingANS”, I set it to true in the begin, and to false in the end, and test in the begin with a branch to know if an ANS is executing. It will works, but imagine that one time the end don’t fire for any reason, the player will never be able to perform trace again.
But if I decide to leave the ANS be called twice, and then in the event called by the begin function of ANS (swing event) I add a do once, then I think it is better. Because in my swing event (that is running) I will reset the do once myself as soon as I decide to stop tracing the multiline. And this way, no matter what happened I will never be blocked because I reset the do once in the same event, the event will not stop running by itself (I think). It is the reason why I think I will have less problem if I do that
Duplicate the animation could be a good solution in some case, I didn’t think about this
Unfortunately, in my case I think I will not do it for the reasons you explained.
Hi, do you really need to keep tracing during a time interval? Or it is possible to use a single notify event? The reason for my question is that you may not need to use an Anim notify state, so try a simple Anim notify (single event). In case you need to keep the notify state, you also can add a ‘do once’ node to trigger the damage after tracing the target, with a reset call after the notify end.
Yes and no. I have to trace during a time interval, but I can also do it using two anim notify instead of notify state. But it will be the same problem. I prefere to use do once as you said
This morning I have implement the solution we talked yesterday (and the one you are saying). It seems everything is working fine now !
Thank you really much everybody for your help ! And for the explaination of why it was doing that
If anyone is encountering this problem in 5.1 - and your anim graph is calling BlendSpaces - make sure you’ve dragged your blendspace into the editor rather than right-click select from there - that seems to give you an embedded type of blendspace (possibly for template ABPs) that makes it trigger those events twice…
Hey, i had this issue as well. I narrowed it down to two different instances of the MeshComponent calling the notify state. Not sure the actual reason, but i am filtering to only allow one of the instances to actually tick.
in .h:
UPROPERTY()
int OwningMeshId = 0;
In Notify Begin:
if (!OwningMeshId && MeshComp->GetOwner()->HasAuthority()) {
OwningMeshId = MeshComp->GetUniqueID();
}
In NotifyTick:
// Sometimes the notify can fire twice on the server for two different mesh components in the same animation
// We only want to process the notify for the mesh component that owns the animation
if (OwningMeshId != MeshComp->GetUniqueID()) {
return;
}