SendEvent action throws NullReferenceException if receiving object has no BehaviorTree

badical

New member
During `OnUpdate` of `BehaviorDesigner.Runtime.Tasks.SendEvent` if the `targetGameObject` doesn't have a BehaviorTree then all code paths lead to a `NullReferenceException`.

I understand that probably the `SendEvent` Task wouldn't be called unless the target has a tree- but this turns out to not always be the case for me. I'll probably create a custom Condition to check for a BehaviorTree before calling SendEvent, but in the meantime I've easily worked around this by adding a null check for `behaviorTree` during OnUpdate and return `TaskStatus.Failure` when it is.

Posting here since I've updated the package recently and this bug regressed since my patch was overwritten (which was totally expected- of course).
 
Top