I am new to this library but it seems great, I am now trying to add some custom actions, I have made sure they have a Category, and that they inherit from ActionTask and are public etc, however they do not come up in the list.
Then the variables which I created (BB* ones) which inherit from BBVariable<T> (T being my object type)… the only thing I thought is that the type being used is an abstract class as there are multiple implementations and is not serializable (it comes from a 3rd party lib).
would you believe it the FIRST issue seems to be down to the fact that the filename was different to the class name (porting over from a playmaker set of actions I made to this, so refactoring as I go)… the vars still do not seem to want to appear…
As you found out, custom tasks have to be in a script of their own with the names being the same. I also throw a warning log if they are not. This is done for safety 🙂
When it comes to custom variables, there are 2 seperate things that you need to take care of:
– First is the VariableData which is what lives on the blackboard.
– Then is the BBVariable which is what can be used in tasks to allow a direct value or a blackboard variable value and is responsible for the intercommunication.
So by just creating a BBVehicle : BBVariable, you are able to use that in a task and if you press the inspector radio button it will allow you select a Vehicle type from the blackboard or directly assign one in the inspector.
If there exist any variable on the blackboard that is or derives Vehicle it will be selectable.
If Vehicle derives a UnityEngine.Object then you don’t really need a custom VariableData since the existing variable Object type can be set to any UnityObject.Type (by the small button on the right in the inspector).
Ah so do I need both a VariableData and a BBVariable in my case, as it is not a Unity.Object.
Is it a massive problem if the object is not attributed as serializable? I looked at your source and you seem to do a lot of reflection so I assume you can still pull access the data required.
Yep, you would need a VariableData too in that case, or you can use the System.Object blackboard variable and write/read to it as an alternative, which is what is used by default if you try to add/set a variable on the blackboard whos type is not supported by any other variable type anyways, kind like a last resort.
If you are refering to the BBVariable object it should be marked as Serializable else it won’t be saved, like for example it wont save the variable name from which it will read from.
If you are refering to the Vehicle object, it doesn’t matter marking it Serializable as long as everything is assigned/used in runtime regarding it.
By the way when making a VariableData make sure that is in a script of it’s own with same nameing as well