I have created a custom task. When it executes, it creates a tween (dotween) that moves a gameobject around. Dotween has a callback function for when it completes a tween. So when the tween ends, I call EndAction(true). The next task deactivates the entity and removes the graph.
The problem is that when the same graph is added back and being run again, not all the tasks have been reset. The custom task described above begins in a failure state, which causes bugs.
Is there an issue if you call EndAction outside of OnUpdate or OnExecute on the custom task?
While EndAction can be called from outside OnExecute and OnUpdate (it is done in a few included tasks), it is generally best if it only gets called from within these two methods, due to potential async operation results, which is what I think happens in your case.
As far as I can tell, your task which disables the entity is executed, while the EndAction from your other custom DOTween relevant task, is executed *after* the entity is disabled, probably due to the tween ending at that time.
While I’ve tried eliminating this async issues, there can still be improvements to make.
Is it possible for you to please send me a small reproduction project showcasing this issue to support_AT_paradoxnotion.com so that I can take a closer look (and possible solution)?
It would be really great and helpful if possible.
Thank you!