Couple questions about writing action and conditional task

_markL

New member
Hi, I'm new to behavior designer and I have a couple questions.

1. What's' the use of GetDefaultGameObject, I can't find it in the documentations.

2. Is it better to write my logic inside behavior designer? or call a functions from another script?

Code:
// Pseudocode

1. Write all the code inside the task
action task
    var agent = GetComponent<NavmeshAgent>();
    agent.SetDestination(target.position)
    agent.isStopped = false;

2. Call the functions from another script
action task
    var moveScript = GetComponent<MoveScript>();
    moveScript.Move(target.position)
 
1. What's' the use of GetDefaultGameObject, I can't find it in the documentations.
GetDefaultGameObject will return the value that is specified by the GameObject field if it is not null. If it is null then it'll return the GameObject used by the current behavior tree.

2. Is it better to write my logic inside behavior designer? or call a functions from another script?
If you do not plan on using that logic outside the behavior tree I would create a new task for it and not in a separate script. With a separate script you'd then have to have a task that calls that script so it ends up being more work for the same results.
 
Top