Hi,
I've been quite frustrated about not finding enough documentation and examples on the event system. I am an experienced programmer and I can code system events with no problem. However, to be quite honest, the relative documentation on the Behavior Designer event system is quite inadequate. I've been reading through your code, re-reading the documentation over and over, searching the examples for hours, and cannot yet send an event in code that gets received by the HasReceivedEvent task in a BehaviorTree. I mean, if you had implemented some send/receive events, both through code and tasks there would be no problem, as I would have found them and solved the problem.
I'm using the Patrol task that is included in the Movement pack, on a very simple behavior tree, which has an enemy patrol between 2 waypoints. All I want to achieve is for the BT on the enemy to stop, when the Player gets killed so that the enemy stops moving.
Inside an "Enemy" MonoBehaviour I have a Player_Killed(object sender, EventArgs eventArgs) event handler, inside which, I want to signal the BT to stop.
Per your documentation, the way to send an event through code is:
var behaviorTree = GetComponent<BehaviorTree>();
behaviorTree.SendEvent<object>("MyEvent", Vector3.zero);
However, there's no explanation about what "object" or "MyEvent" represent, and if only a single parameter is necessary. It doesn't also describe how the corresponding HasReceivedEvent task in the BT should be configured to receive the "MyEvent". Does "MyEvent" represent the name of a method somewhere in code, used similarly to a Unity message? Or is it just a string that must correspond to the same string set in the HasReceivedEvent task. In any case, I've tried both, but it doesn't work.
Please excuse my frustration, but I've spend hours on something that should be solved in minutes, and I do believe that your documentation and examples are quite inadequate and don't reflect the actual quality of this asset.
I've been quite frustrated about not finding enough documentation and examples on the event system. I am an experienced programmer and I can code system events with no problem. However, to be quite honest, the relative documentation on the Behavior Designer event system is quite inadequate. I've been reading through your code, re-reading the documentation over and over, searching the examples for hours, and cannot yet send an event in code that gets received by the HasReceivedEvent task in a BehaviorTree. I mean, if you had implemented some send/receive events, both through code and tasks there would be no problem, as I would have found them and solved the problem.
I'm using the Patrol task that is included in the Movement pack, on a very simple behavior tree, which has an enemy patrol between 2 waypoints. All I want to achieve is for the BT on the enemy to stop, when the Player gets killed so that the enemy stops moving.
Inside an "Enemy" MonoBehaviour I have a Player_Killed(object sender, EventArgs eventArgs) event handler, inside which, I want to signal the BT to stop.
Per your documentation, the way to send an event through code is:
var behaviorTree = GetComponent<BehaviorTree>();
behaviorTree.SendEvent<object>("MyEvent", Vector3.zero);
However, there's no explanation about what "object" or "MyEvent" represent, and if only a single parameter is necessary. It doesn't also describe how the corresponding HasReceivedEvent task in the BT should be configured to receive the "MyEvent". Does "MyEvent" represent the name of a method somewhere in code, used similarly to a Unity message? Or is it just a string that must correspond to the same string set in the HasReceivedEvent task. In any case, I've tried both, but it doesn't work.
Please excuse my frustration, but I've spend hours on something that should be solved in minutes, and I do believe that your documentation and examples are quite inadequate and don't reflect the actual quality of this asset.