I think it would be better if you try to achieve what you want by using some sort of static events, in which the ActionTask can subscribe to instead of trying to get a reference to the action task object itself.
Here is a very rough example of what I mean:
1
2
3
4
5
6
7
8
9
10
11
12
publicclassExample:MonoBehaviour{
publicstaticevent Action onMoveOn;
publicstaticvoidMoveOn(){
if(onMoveOn!=null){
onMoveOn();
}
}
}
You could also turn the above example into some kind of a “manager” if you’d like.
Then in your action tasks, you could subscribe to the event in the OnExecute method like this:
1
2
3
Example.onMoveOn+=()=>{EndAction();}
This way, and by using events in general, you don’t have to worry about referencing everything. 🙂