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 three BBParameters defined, those being “Target”, “Speed”, and “Keep Distance”. Here, Target has been linked to a Blackboard variable, while the others are set a direct value.
Remember that even though you also have access to the Blackboard directly through the inherited .blackboard property if you so require to read/write manually to its variables, it is highly recommended to use BBParameters instead.
© Paradox Notion 2014-2024. All rights reserved.