When prefetch fails, don't print error if variable is on blackboard

This commit is contained in:
Serhii Snitsaruk 2024-03-11 22:12:44 +01:00
parent b09006a11b
commit e2edb083ff
1 changed files with 4 additions and 1 deletions

View File

@ -284,8 +284,11 @@ inline void bb_add_var_dup_with_prefetch(const Ref<Blackboard> &p_blackboard, co
if (n != nullptr) { if (n != nullptr) {
var.set_value(n); var.set_value(n);
} else { } else {
// Print error only if the variable is not present (it can be initialized by the user or in the parent scope).
if (!p_blackboard->has_var(p_name)) {
ERR_PRINT(vformat("BlackboardPlan: Prefetch failed for variable $%s with value: %s", p_name, p_var.get_value())); ERR_PRINT(vformat("BlackboardPlan: Prefetch failed for variable $%s with value: %s", p_name, p_var.get_value()));
} }
}
p_blackboard->add_var(p_name, var); p_blackboard->add_var(p_name, var);
} else { } else {
p_blackboard->add_var(p_name, p_var.duplicate()); p_blackboard->add_var(p_name, p_var.duplicate());