Can see and can hear problem

I've got this simple behavior tree where object patrols using patrol points which are collected using "Find game objects with tag" task.

If the object sees or hears player then patrol task should be cancelled and the object should go to the position where player was seen or heard. The problem is that it works if I use one of the sense tasks but not if I use both of them.

If I use both of them then when object first sees player it does not move to the position where player is. If object first hears player it starts to move to the position but stops instantly when it sees player. It seems that it does not run the Seek task or maybe if it does nothing happens. Instead it seem to go to the Wait task.

I suppose there is something wrong with this behavior tree? How should I build this?

I also noticed that when it restarts the behavior tree after the Wait task the patrol point variable increases in size. I use game object list variable with initial size of 50 but after some time I noticed that the list size has gotten to 1200. How can I prevent the list getting larger and larger?



1584809167430.png
 
Glad you got the first part solved. Another way to do this would be to not use the parallel task and instead use conditional aborts. Take a look at this tree structure which can both see and hear:


I use game object list variable with initial size of 50 but after some time I noticed that the list size has gotten to 1200. How can I prevent the list getting larger and larger?
You could set the size within the Awake method which will only run once.
 
Thanks! I'll take a look. Justin, I work in IT field and I can say that the support you provide is excellent. I work with many companies and some of them are big and they still do not have as good support what you give.
 
Thanks! I'll take a look. Justin, I work in IT field and I can say that the support you provide is excellent. I work with many companies and some of them are big and they still do not have as good support what you give.
Thank you! If you don't mind leaving a review I'd really appreciate it :)
 
Top