Hey,
Thanks for the elaboration and your suggestion. It overally makes sense I think, but I need to think a bit more about this 🙂
I did make some tests you can also try out. If you want, please open up BlackboardSource.cs file and change the first clause in the AddVariable method in line #80 to be like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if(variables.ContainsKey(varName)){
varexisting=GetVariable(varName);
if(existing!=null){
if(existing.CanConvertTo(type)){
Debug.LogWarning(string.Format("<b>Blackboard:</b> Variable with name '{0}' already exists in blackboard '{1}'. Returning existing instead of new.",varName,this.name));
returnexisting;
}
if(existing.CanConvertFrom(type)){
Debug.LogWarning(string.Format("<b>Blackboard:</b> Variable with name '{0}' already exists in blackboard '{1}' but is of assignable type. Upgrading type and returning new variable.",varName,this.name));
RemoveVariable(varName);
}
}
}
This is just a test and not meant to really be used however 🙂 It does handle the specific case you showcased, but I will need to see what other kind of problems this may create.
Let me know what you think if you do test it.
Thank you!
Join us on Discord: https://discord.gg/97q2Rjh
Login
Register
By registering on this website you agree to our Privacy Policy.