Gain access to a task's parent (-task)

To further explain for the future, you can think of it as you were coding, for instance, in the above it is Add Task > Actions, thinking of making a unity action... > Unity (Unity built in api stuff) > Transform (how do you get a parent in code? Transform) > Get Parent (I think you get it now) :)
 
Hi FastSkillTeam,

I appreciate you answering - the thing is, what I need is to gain access to the task that is the parent of another task. I expected something like

Code:
new MyActionTask().GetParentTask()

Or is there any other way to traverse the tree? I'm asking, because I'd like to create unique string-ids in the format "entry.repeater.sequence...etc...sequence.myAction" by traversing the tree from each action upwards towards the Entry Task - do you know if that's possible?
 
Creating a hard reference like this is not something that you should need to do with a behavior tree task. Behavior tree tasks are supposed to be modular so you can place them in any location within your tree and not depend on a particular structure. This is why the task doesn't contain a specific reference to the parent task.

If you absolutely do need it you can add a public variable to your task and then link to it within the Behavior Designer editor. I highly recommend against doing this though because it makes your task less modular.
 
Hi,

sure, assuming a static relationship between a task and its parent would be a bad idea. I've been interested in the ability to traverse the tree in composition, assuming that there'd be a way to do this, as is rather common for trees and their like, but I managed to find a workaround.

Thanks for responding anyway.
 
Top