Extending variable type list for blackboard

Xaon

New member
Hey

I've created custom shared variables that stores references to some custom components. I'd like to assign them in a way so many tasks within behaviour tree can reference the same component.

Full case goes like this: I have component that is a container for patrol points. I want to assign this component do BT instance on spawn. Now tasks should be able to access that container component without knowing from where this reference came from (by using SharedVariable).
 

Attachments

Xaon

New member
Bump

I'll be ok with importing source code and adding any boilerplate code if needed. Simply pointer to where those types are defined will be very helpful.
 

Xaon

New member
Hi Justin. Thanks for reply but it doesn't (fully) answer my question.
What I need is a single point of entry for spawning code to assign a reference which all tasks in the behaviour tree will use. At the same time I want spawner to know only about behaviour tree but not tasks. And similarly I wan't tasks to comunicate with outside world only through blackboard.

Here's a video where I explain my case in more detail:
 

Justin

Administrator
Staff member
Ah, I see. You should have the behavior tree disabled, assign the patrol values, and then enable the behavior tree. You can do that with the EnableBehavior/DisableBehavior method. This will allow you to assign the values before the behavior tree tasks are run.
 

Xaon

New member
Actually for test purposes I'd like to assign them on prefab instance directly in scene first. But thanks for link.

Still this doesn't help me with achieving a type-safe and robust reference propagation.
Well, patrol points aren't even best example. They're just a current working thing I'm testing waters on :)
It's more that I know I will need to create this type of connections in the future. I also know that it will hit me back if those connections won't be type safe or if they will require additional code maintanance in order to rewire connections or reuse solutions.

1575035790713.png

Right now it seams to me that achieving those connections will require some small but custom extention in Behavior Designer code. I'll jump into source code once I have a bit more time.
 

Xaon

New member
I think that I almost found solution. Moving SharedGroundWaypointGroup.cs file under Assets\Behavior Designer\Runtime\Variables folder allowed Behavior Designer to pick up the new type and add it to list. Don't know if I missed that in docs or if it wasn't mentioned there.

1575048526121.png 1575048553605.png

Now the problem I'm left with is to reference my custom types from within Behavior Tree assembly. Any suggestion on how to make that manageable?
 

Justin

Administrator
Staff member
The Variables folder isn't special - as long as you inherit SharedVariable Behavior Designer will be able to pick it up. Maybe you need to add Behavior Designer to your assembly definition?
 
Top