Global Blackboard from script?

FlowCanvas Forums Support Global Blackboard from script?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #489
    rixter757
    Participant

    Hi Gav,

    Likely a newbie question. Here’s my code:

    I am getting the error “Object reference not set to an instance of an object”. I don’t get it, surely myPos doesn’t need to be a reference to an object when I only want to assign a value to it from a Blackboard variable?

    This is the code you posted for me in a thread below. I also did see a similar question where you advise GetComponent<Blackboard>() so I’m confused what is needed here.

    Another point is that this is my Global Blackboard. The above code likely references the local?

    Thanks,

    Rix

    #491
    Gavalakis
    Keymaster

    Hey,

    The null reference is because the blackboard is not assigned a reference. Try this code bellow and please make sure that this script is attached to a gameobject that has a Blackboard component attached as well, since we assign the reference by GetComponent from this gameobject.

    Let me know if this works for you.
    Cheers!

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

    #495
    rixter757
    Participant

    Hi Gav,

    Yes this works well for the local Blackboard, thank you.

    For information, how would I go about accessing the Global Blackboard?

    Rix

    #500
    Gavalakis
    Keymaster

    Hey,

    Sure 🙂
    You can get the reference of a global blackboard with the static method GlobalBlackboard.Find(string name), where the parameter is the blackboard name. Here is an example:

    Let me know if this works for you.
    Thanks.

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

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