Skip to content

Commit

Permalink
Fix: BBParam saved_value defaults to null
Browse files Browse the repository at this point in the history
  • Loading branch information
limbonaut committed May 1, 2024
1 parent 6d41f82 commit 5ee54d6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions blackboard/bb_param/bb_param.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ Variant BBParam::get_value(Object *p_agent, const Ref<Blackboard> &p_blackboard,
ERR_FAIL_COND_V(!p_blackboard.is_valid(), p_default);

if (value_source == SAVED_VALUE) {
if (saved_value == Variant()) {
_assign_default_value();
}
return saved_value;
} else {
ERR_FAIL_COND_V_MSG(!p_blackboard->has_var(variable), p_default, vformat("BBParam: Blackboard variable \"%s\" doesn't exist.", variable));
Expand Down Expand Up @@ -114,6 +117,4 @@ void BBParam::_bind_methods() {

BBParam::BBParam() {
value_source = SAVED_VALUE;

_assign_default_value();
}

0 comments on commit 5ee54d6

Please sign in to comment.