How to access and modify variables values in specific nodes

Pedro Civa

New member
For an example. Pretend I have node A and node B, they are of the same type (task).
For this task I have a public SharedBool that can have its value set on the task inspector.
Would there be a way of having another task, lets call it "Get Bool Value", and with this task you could select a node from the tree and access the value that that variable holds in that node you selected?
I tried using public Task and it allows me to select a node on the tree. But apparently it doesn't hold the kind of information I want.
I was thinking maybe use the Task to select the node and then from that get a reference of the class and modify the values, but I'm not sure if that would work or if it makes sense.
To sum up all I'm looking for is a way of making a note that can perform actions in specific nodes on the tree.
 

Justin

Administrator
Staff member
Within your task you can reference other tasks, and from there you can get the variable through script. For example:

Code:
public class MyTaskB : Task {
   public MyTaskA task;
   
   public void OnStart() {
      task.TaskVariable++;
   }
Within the editor you'll need to assign MyTaskA.
 
Top