Event Not Being called?

AlexIsCoolYo

New member
Hello,

I'm using the event system & I've added the "Has Received Event" task, given it the correct name and value to store. My code is calling the function and I'm getting no errors, also using conditional aborts to re-evaluate if the event was received.

I just can't get it to work, not sure what I'm doing wrong. Any help would be great!


Behaviour Tree:

df381e8806ab77a07fbcc5271ea66b97.png

The "Has a new location to defend?" event never returns success, my code points towards it sending the event and it just sits on the Idle task


Thanks!
 
Last edited:
I would not use a both conditional abort with the Has Received Event task. Has Received Event returns success the frame that the event is received, but then the next frame it is set to false so your subbranch will be aborted immediately.

Also, your event will only be received when the Idle task is active. If you want it to be received earlier you should move that branch to the left in your tree.
 
I would not use a both conditional abort with the Has Received Event task. Has Received Event returns success the frame that the event is received, but then the next frame it is set to false so your subbranch will be aborted immediately.

Also, your event will only be received when the Idle task is active. If you want it to be received earlier you should move that branch to the left in your tree.
Ok, so I changed it up a bit, but still can't get this event to return success. Went off the doc example.

This is what I have & this is on the far left of the tree:

0265658c14b806ed798301de7712ff6c.png

Thanks for the help!
 
Your tree looks better so now it's probably related to sending the event. Here's a basic behavior tree that you can use to see where your event call is going wrong.
 

Attachments

  • Event.unity
    11.1 KB · Views: 10
Your tree looks better so now it's probably related to sending the event. Here's a basic behavior tree that you can use to see where your event call is going wrong.
I'm calling it through code, the debug.log is being called fine with the correct Vector3 location, but the event doesn't get received, nothing appears to happen when it's called.

Code:
a2a8974789149d8154023d70b56f3cb6.png

This is the entire BT, it just stays on Idle.
d753696a720c0569a70545ccd6e8e857.png

Thanks for the help
 
Instead of SendEvent<Vector3> try SendEvent<object>. Has Received Event is registered for objects instead of the specific SharedVariable type.

(thanks for the review - I'll see if the docs need to be modified once we get this figured out :) )
 
Instead of SendEvent<Vector3> try SendEvent<object>. Has Received Event is registered for objects instead of the specific SharedVariable type.

(thanks for the review - I'll see if the docs need to be modified once we get this figured out :) )

SendEvent<object> fixed it! Seems to be all working now.


Thanks for the support! :)
 
Top