W
W
WOSNE2021-10-23 07:28:27
Unity
WOSNE, 2021-10-23 07:28:27

DoTween, how to stop the animation if the object being animated becomes null?

When performing an attack animation, the object that is moving can be destroyed. And when it is destroyed, DoTween throws an error that it continues to animate, but there is no object. And the question is how to make this check or how to disable, stop a specific movement, and so on. So that it does not continue to execute if the object is null

Please tell me, I can’t find it in any way (

In this example, if the object is not destroyed, it does everything, if it is destroyed, it gives an error that there is no object.

sequence.Insert(0.8f, Object. transform.DOMove(ObjectGetDamageTransform, 0.2f).SetLoops(2, LoopType.Yoyo))
;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
ProstoLubitel, 2021-10-24
@ProstoLubitel

I, as a collective farmer, would check if the object exists, and if not, then I would disable the animator component in general. But in fact, there are many options, for this part of the code, I personally don’t really understand what’s what.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question