Hi, I have encountered what I believe to be a bug in the Behavior package where the blackboard variable source object gets swapped by some magic (hard to trace process).
Here’s my setup:
- I have a Character and a bunch of abilities that all inherit from CharacterAbility
- Attached to the character is a BehaviorAgent that drives input to the abilities for NPCs
- I have made a simple custom Condition node that has a
BlackboardVariable<CharacterAbility>to check if that particular implementation of the CharacterAbility is Authorized to be executed.
Condition Code
[Serializable, Unity.Properties.GeneratePropertyBag]
[Condition(name: "AbilityReady", story: "Is [Ability] Ready?", category: "Conditions", id: "1aca371128344d88ef24165aa09d1b2c")]
public partial class AbilityReadyCondition : Condition {
[SerializeReference] public BlackboardVariable<CharacterAbility> Ability;
public override bool IsTrue() {
return Ability.Value.AbilityAuthorized;
}
}
- I have assigned an ability called CharacterDash2D from my Blackboard to this node
Here’s where I encounter an undesirable behavior:
-
At runtime, when the Behavior Agent runs into this Condition, it appears have swapped the reference from the CharacterDash2D to another CharacterAbility attached to the Agent, namely Orientation2D the first one attached to the GameObject, almost as if it does a
GetComponent<CharacterAbility>call.
As can be seen in the image below from debugging the value of the blackboard variable
-
I also confirmed that this behavior is consistent by rearranging my components on the GameObject, and it seems like it will consistently grab the top component by base type CharacterAbility despite having explicitly assigned the CharacterDash2D as the BlackboardVariable and also in the BehaviorAgent Inspector.
This is at least to me an undesirable behavior and I assume it’s a bug, but I at least wanted to bring attention to this.


