Hey! I’ve been enjoying NodeCanvas and while creating an extension class to make accessing graphs and blackboards at runtime even easier through code I’ve come across an issue that I don’t know if NodeCanvas is designed to support out of the box.
Since multiple blackboard components can be added to a single gameobject and don’t require a unique name like their global versions is there a way I can reliably be able to get a certain blackboard based on its name at runtime? I know there is a name prop for the blackboard source but it doesn’t seem to be anything which is set based on the user
Thanks for your positive feedback. I am very glad you like NodeCanvas!
Even though multiple Blackboard components can be added on the same gameobject, it is really something I wouldn’t recommend doing, since by design NodeCanvas is made so that multiple GraphOwners (BTOwner, FSMOwner) attached on the same gameobject share the same Blackboard attached on that same gameobject and as such having one Blackboard attached is recommended for that reason.
I have previously thought of adding [DisallowMultipleComponent] attribute to Blackboard class for the above reason, but never really did so 🙂
In any case, Blackboard.cs do have a name property which -as you said- points out to BlackboardSource.name property, and while you can set that name in script, it is not exposed in the inspector. You can if you want however, open up BlackboardInspector.cs file and add the following line of code to expose and thus edit the name in the inspector: