J jvt619 New member Oct 14, 2020 #1 How to end a certain task that is running via script in a monobehaviour?
Justin Administrator Staff member Oct 15, 2020 #2 One way would be to have your active task check against your MonoBehaviour script to decide if it should continue. If it can't then it should return success or failure.
One way would be to have your active task check against your MonoBehaviour script to decide if it should continue. If it can't then it should return success or failure.
J jvt619 New member Oct 15, 2020 #3 Should I use the NodeData.ExecutionStatus in monobehaviour so that I can stop a task from a behavior from running? behaviorTree.FindTask<Sleep>().NodeData.ExecutionStatus = BehaviorDesigner.Runtime.Tasks.TaskStatus.Success; Click to expand... It doesn't seem to stop the task if it is still running.
Should I use the NodeData.ExecutionStatus in monobehaviour so that I can stop a task from a behavior from running? behaviorTree.FindTask<Sleep>().NodeData.ExecutionStatus = BehaviorDesigner.Runtime.Tasks.TaskStatus.Success; Click to expand... It doesn't seem to stop the task if it is still running.
Justin Administrator Staff member Oct 15, 2020 #4 No, you don't want to set the execution status. Within your task you should return a task status of success or failure. Code: public TaskStatus OnUpdate() { if (myMonoBehaviour.ShouldEndTask()) { return TaskStatus.Success; } return TaskStatus.Running;
No, you don't want to set the execution status. Within your task you should return a task status of success or failure. Code: public TaskStatus OnUpdate() { if (myMonoBehaviour.ShouldEndTask()) { return TaskStatus.Success; } return TaskStatus.Running;