The Blackboard can easily be accessed manually to read/write from/to its variables. All you need is a reference to it of course. Within tasks and nodes, you get a reference through the .blackboard inherited property, but you can always of course use GetComponent<Blackboard>() since blackboard is a component.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
//Adds a new variable to the Blackboard of type and name specified. public Variable AddVariable(string, Type) //Gets the Variable instance of name and type specified. public Variable GetVariable(string, Type) //The generic version of the above. public Variable<T> GetVariable<T>(string) //Get a variable value that is of specified name and of type T or assignable to type T. //This is easier because it returns the value directly instead of the variable instance. public T GetVariableValue<T>(string) //Set the value of a variable with specified name to the new value passed. public void SetVariableValue(string, object) /// ///Following is the API for saving/loading the blackboard variables for your convenience /// //Save the variables state in PlayerPrefs with the key specified. //Returns the serialized blackboard json string. public string Save(string) //Loads the variables back from PlayerPrefs from the key specified. Returns true if success. public bool Load(string) //Returns the serialized blackboard to json without saving to PlayerPrefs. public string Serialize() //Deserialize a json serialized blackboard directly. Returns true if success. public bool Deserialize(string) |