BBParameters are a great way of making your tasks be more dynamic by having the ability to use blackboard variables in place of simple value fields within your task. In short, when declaring a field of some type, you would instead use BBParameter<T>, which will allow you to either select a Blackboard variable or define a value directly. Here is the same delay example as before, but using a BBParameter<float> instead.
1 2 3 4 5 6 7 8 9 10 11 12 |
using UnityEngine; using NodeCanvas.Framework; public class WaitAction : ActionTask { public BBParameter<float> timeToWait; protected override void OnUpdate(){ if (elapsedTime > timeToWait.value) EndAction(true); } } |
The following “Move To Target” action task for example, has two BBParameters defined, those being “Target” and “Speed”. Here, Target has been linked to a Blackboard variable, while Speed is set directly to 3.
Remember that you also have access to the Blackboard directly, through the inherited .blackboard property if you so require to read/write manualy to it’s variables.