The sequence action doesn't work.

GuaiWuLieRen

New member
Unity_2018-12-16_22-35-54.png

the CanFlip conditional action is executed successfully, but the next two actions(Wait and Flip) are not executed at all, this is why?
 
Last edited:
If I were to guess it is probably something related to an interrupt, but you can debug by enabling logging on the behavior tree component. This will tell you exactly what is happening.
 
I found the logic of DB seems a little weird.
My idea is to execute Flip Task immediately when the CanFlip returned a TaskStatus.Success.
but I found that the CanFlip seems to execute dozens of times in a row. in the end, it actually returned a TaskStatus.Failure.

so my question is how can I run some action tasks immediately when a Conditional Task returned success
or how can I rewrite the CanFlip script to do what I exactly what I want to do.

my English is not good, hope you can understand what I mean.


C#:
public class CanFlip : Conditional
{
    public SharedFloat flipTimer;
    public SharedFloat actionChance;

    private float timer;

    public override void OnAwake() {
        timer = Time.time + flipTimer.Value;
    }

    public override TaskStatus OnUpdate() {
        if(timer < Time.time) {
            timer = Time.time + flipTimer.Value;

            if (Random.value <= actionChance.Value) {
                return TaskStatus.Success;
            }
        }

        return TaskStatus.Failure;
    }
}
 
Your task looks correct. What I would do is isolate that branch and just test it out without any other active branches to see if you can get it working correctly there. After you get it to work you can then add more complexity by adding in more branches. If you haven't seen it take a look at this video for an overview of the sequence task works:

 
Top