Get Blackboard by name?

NodeCanvas Forums Support Get Blackboard by name?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #12371
    charblar
    Participant

    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

    #12379
    Gavalakis
    Keymaster

    Hello!

    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:

    Changing the name like so will not break anything at all. 🙂

    Let me know if that works for you.
    Thanks again!

    Join us on Discord: https://discord.gg/97q2Rjh

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.