Issue with Custom Events in Behavior Tree Services

Hi,

I’m working with behavior trees in 4.4.0 and I’m trying to create a system where an event can be fired from the level blueprint and then handled by an active service within the unit’s behavior tree.

I got this to work by creating a custom event with no parameters in the my custom AI controller. When the unit enters a trigger box, the level blueprint fires the event which is then correctly handled by the service.

After getting this to work, I added an input Vector to the event as seen below.

14864-correct.png

This worked as intended until I closed the editor and rebuilt it in Visual Studio. When the editor is opened again, the event that is bound in the service throws a compiler error for not matching the signature of the event. This is because for some reason the output parameters are no longer there, as seen below.

14865-error.png

When I change the event back, I have to re-add the service to the behavior tree node, but after that it runs fine again until the editor is closed and rebuilt. A few notes:

-This only happens if the service in question is attached to a node in the behavior tree. If it is not attached when the editor is closed then the blueprint is unchanged when the editor is re-opened.

-The Behavior Tree was originally created in 4.3 and recently ported to 4.4. I did not try to implement the events in 4.3 so I am unsure if that makes a difference.

-I tried cleaning and rebuilding the solution with no effect.

Is your custom AI controller implemented in BP? If so then let’s perform an experiment. After reopening the editor first open the AI controller BP and only after it loads open the BT stuff. If it works fine then it’s a known bug (but please let us know!). If not, any additional info would help.

Cheers,

–mieszko

Hi Mieszko,

Thanks for the quick response!

Even after opening the controller before the behavior tree and service, it was still broken.

I have a hierarchy of custom controllers that goes AAIController->CustomBaseController->CustomHumanController where the two custom controller classes are created in C++. Then I have a CustomAllyController that is defined in Blueprint and extends the Human Controller. The event causing the issue is defined as an Event Dispatcher in the Ally Controller.

The only way I can see us solving this mystery is by you sharing your project with us. Feel free to send it directly to me at mieszko.zielinski@epicgames.com.

Cheers,

–mieszko

Are you able to test the issue with the latest UE4 code (meaning head of master branch on github)? Or at least with UE4 4.4.1?

So I revisited this issue today after putting it to the side for a week or two and it doesn’t appear to be happening anymore.

No idea what fixed it… maybe it was some sort of serialization issue and it was forced to reserialize because of some of my other changes. Not really sure, but I’m glad it’s working now.

Thanks for the help!