I'm really struggling here. I've been away from this for a while and tried reconstructing the thing from scratch. (I've given up using Behaviour Trees until I've got this other stuff sorted.)
The entire thing is not working logically at all, to the point where I don't trust the debug information.
For instance, can someone explain this:
When a food object appears, it triggers into the state I want correctly. This state does the following, in order:
1. Find closest (tagged "food" storing the result in "priorityObject")
2. Move towards (Target object "priorityObject")
What happens is, the food appears. The agent starts moving towards it. However, debug shows priorityObject is null. How then, please, is it moving towards it??? It then hits the food object, whereupon priorityObject is assigned to the food object. And as before, instead of destroying it, it simply nudges it along.
Surely there is something wrong with the debug here? (Incidentally, another thing I've noticed, in the debug log window, it says it's supposed to show the values of the variables at the particular state you have selected, but in mine it only shows the current values, no matter what state I have selected.)
Any help please, because I'm close to throwing in the towel.