Search Unity

Behavior Designer - Behavior Trees for Everyone

Discussion in 'Assets and Asset Store' started by opsive, Feb 10, 2014.

  1. MitchStan

    MitchStan

    Joined:
    Feb 26, 2007
    Posts:
    568
    That would be great to have this in the next build.

    But I did already try exactly what you suggested but I couldn't get the sharedCurve.Value.Evaluate() to compile. I'll try again tomorrow and let you know if it works.
     
  2. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Is it that the curve never shows up after making a change in Unity 2017.1? I actually just fixed this yesterday so if that's the case I can send you an updated version :)
     
  3. dearamy

    dearamy

    Joined:
    Mar 17, 2015
    Posts:
    68
    Hi, opsive, just got the asset. It looks like the variable list in the editor can go really long. I was just wondering is there any way to collapse these variables? Maybe something like creating a subtree decoration to organize the sub-tasks or just a collapse option in the variable list?
     
  4. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Organizing the tree into subtrees (called External Trees) sounds like the way to go. You can use the Behavior Tree Reference task to reference those external trees and have the variables only focused on that particular branch within the subtree. If you'd like to transfer a value from one subtree to another you can have the same variable name and type within both subtrees and it'll transfer.
     
  5. MitchStan

    MitchStan

    Joined:
    Feb 26, 2007
    Posts:
    568
    I'm on 5.6 and I may have just coded it wrong because I'm so far over my head with this it's embarrassing. I couldn't get as far as the curve showing up or not, I couldn't fix the compiler error. But I'll try again this afternoon and let you know how it goes.
     
  6. MitchStan

    MitchStan

    Joined:
    Feb 26, 2007
    Posts:
    568
    A day later and your code works great! Thanks, Justin.
     
    opsive likes this.
  7. MitchStan

    MitchStan

    Joined:
    Feb 26, 2007
    Posts:
    568
    Hey Justin,

    I see from your docs that OnDrawGizmos() is allowed to be called from within a task. That is a great feature. It almost works, but its a little wonky. Perhaps I'm doing something wrong.

    According to the docs I should do this --

    Code (CSharp):
    1. // Allow OnDrawGizmos to be called from the tasks
    2. public virtual void OnDrawGizmos();
    But I think that's outdated. Should it be instead --
    Code (CSharp):
    1. public override void OnDrawGizmos()
    2. {
    3. }
    So it kind of almost works. But I get errors in the console:

    NullReferenceException: Object reference not set to an instance of an object
    SeekToTargetPosition.OnDrawGizmos () (at Assets/Hockey/AI/old/SeekToTargetPosition.cs:48)
    BehaviorDesigner.Runtime.Tasks.ParentTask.OnDrawGizmos ()
    BehaviorDesigner.Runtime.Tasks.ParentTask.OnDrawGizmos ()
    BehaviorDesigner.Runtime.Tasks.ParentTask.OnDrawGizmos ()
    BehaviorDesigner.Runtime.Behavior.DrawTaskGizmos (BehaviorDesigner.Runtime.Tasks.Task task)
    BehaviorDesigner.Runtime.Behavior.DrawTaskGizmos (Boolean selected)
    BehaviorDesigner.Runtime.Behavior.OnDrawGizmosSelected ()
    UnityEditor.DockArea:OnGUI()

    The gizmo does get drawn but not the color I want. I change colors in different tasks but this error seems to screw up the gizmo.

    Any idea how to remedy this?

    Thanks,

    Mitch
     
  8. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    That's correct - you should do an override instead of virtual. I'll update that aspect. What is on line 48 of SeekToTargetPosition? It looks like that line is causing the exception.
     
  9. MitchStan

    MitchStan

    Joined:
    Feb 26, 2007
    Posts:
    568
    Code (CSharp):
    1. public override void OnDrawGizmos()
    2.     {
    3.         Gizmos.color = Color.white;
    4.         Gizmos.DrawSphere(player.targetPosition, 1);
    5.         Gizmos.DrawLine(transform.position, player.targetPosition);
    6.     }
    Line 48 is in the OnDrawGizmos method:
    Gizmos.DrawSphere(player.targetPosition, 1);

    But player.targetPosition is referenced correctly when used in OnUpdate() method in the same task. It is not a null reference.

    So went ahead and I declared a public Vector3 targetPosition and in the OnUpdate() method of the task I set targetPosition = player.targetPosition.

    I then changed the line to:
    Gizmos.DrawSphere(targetPosition, 1);
    and that works. It's referenced with no issue.

    But then I get the same error on the next line:
    Gizmos.DrawLine(transform.position, targetPosition);

    So that tells me it's also not referencing the transform in OnDrawGizmos() which is weird because again, transform is referenced with no issue in the OnUpdate() method in the same task.

    So I declared another public Vector 3 position and in the Update() method I set position = transform.position.

    With that said my code is now as such:
    Code (CSharp):
    1. public override void OnDrawGizmos()
    2.     {
    3.         Gizmos.color = Color.white;
    4.         Gizmos.DrawSphere(targetPosition, 1);
    5.         Gizmos.DrawLine(position, targetPosition);
    6.     }
    and it works okay - no issues.

    So something is wonky in OnDrawGizmos but I got around it by assigning those variables to public variables and using the new public variables instead.

    I hope all this helps you figure out what's going on with OnDrawGizmos().

    Best,
    Mitch
     
  10. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    OnUpdate isn't called when the task isn't active (such as when the game is in edit mode) so that's why you are getting a missing player reference. You'll either need to assign the reference manually like you are or look it up within OnDrawGizmos.
     
  11. MitchStan

    MitchStan

    Joined:
    Feb 26, 2007
    Posts:
    568
    I don't think that's the issue - I'm caching a reference to player in OnAwake() and have no issues with that reference in OnStart() and OnUpdate().

    I can reproduce the error for you in a new project.
    I created a brand new project and put an empty gameObject in the scene. I have one task only:

    Code (CSharp):
    1. using UnityEngine;
    2. using BehaviorDesigner.Runtime;
    3. using BehaviorDesigner.Runtime.Tasks;
    4.  
    5. public class GizmoTest : Action
    6. {
    7.     public override void OnStart()
    8.     {
    9.      
    10.     }
    11.  
    12.     public override TaskStatus OnUpdate()
    13.     {
    14.         return TaskStatus.Success;
    15.     }
    16.  
    17.     public override void OnDrawGizmos()
    18.     {
    19.         Gizmos.DrawSphere(transform.position, 2);
    20.     }
    21. }
    So all it is supposed to do is Gizmos.DrawShphere at the transform.position.

    It does not draw a sphere and I get the null reference at line 19 which is the call to:
    Gizmos.DrawSphere(transform.position, 2). It seems as if it's not getting a reference to the transform.

    So I believe something is wonky independent of my goofy code. :)

    I hope this is helpful.

    Mitch
     
  12. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    The transform is only cached at runtime as well :) With OnDrawGizmos it's best to assume that nothing is cached unless you have done it yourself. I can cache the GameObject and Transform reference for the next update though.
     
  13. MitchStan

    MitchStan

    Joined:
    Feb 26, 2007
    Posts:
    568
    :):)
    Ah. I see. Now it makes sense what's happening under the hood. Thanks for clarifying.

    Your call of course as to whether to include the cache of transform and gameObject in the next update but if you did, it would then be more consistent with how OnDrawGizmo() works in unity monoBehavior. So I'd like it included.:)
     
    opsive likes this.
  14. bpolley

    bpolley

    Joined:
    Mar 18, 2014
    Posts:
    10
    Hi,

    I've recently updated a project from 5.5.2 to 5.6.2 and I am getting the following error from one of my behaviours that worked fine in 5.5.2. (I did delete the previous version of BehaviorDesigner and upgraded to the latest version on the Asset Store(

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. BinaryDeserialization.LoadTask (BehaviorDesigner.Runtime.TaskSerializationData taskSerializationData, BehaviorDesigner.Runtime.FieldSerializationData fieldSerializationData, System.Collections.Generic.List`1& taskList, BehaviorDesigner.Runtime.BehaviorSource& behaviorSource)
    3. BinaryDeserialization.Load (BehaviorDesigner.Runtime.TaskSerializationData taskData, BehaviorDesigner.Runtime.BehaviorSource behaviorSource)
    4. BehaviorDesigner.Runtime.BehaviorSource.CheckForSerialization (Boolean force, BehaviorDesigner.Runtime.BehaviorSource behaviorSource)
    5. BehaviorDesigner.Runtime.Behavior.CheckForSerialization ()
    6. BehaviorDesigner.Runtime.BehaviorManager.EnableBehavior (BehaviorDesigner.Runtime.Behavior behavior)
    7. BehaviorDesigner.Runtime.Behavior.EnableBehavior ()
    8. BehaviorDesigner.Runtime.Behavior.Start ()
    This is only occuring on objects with one particular behavior. The other behaviors ported over without any issues.

    Thanks!
     
  15. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    It sounds like the serialization changed so what I would do is open it in Unity 5.5 with the latest Behavior Designer version. If that works you should then make a change (such as dragging some tasks around) so the tree reserializes and then update to 5.6.
     
  16. bpolley

    bpolley

    Joined:
    Mar 18, 2014
    Posts:
    10
    Thanks for the advice. That did not fix the issue but I have a better sense of what is going wrong now. So it's not that one behavior is not loading properly. Instead, if an object with that one behavior is included in the scene, the error is called on both that object and all other objects with any behavior on it. If that object/behavior is removed from the scene the rest of the behaviors run fine.

    Updating Behavior Designer to 1.5.10 (previously 1.5.6) has carried this issue into Unity 5.4 and 5.5 (working previously)
     
  17. bpolley

    bpolley

    Joined:
    Mar 18, 2014
    Posts:
    10
    UPDATE: I rewrote the behavior in Unity 5.6 using Behavior Designer 1.5.10. The error no longer appears. It would still be good to look into the issue. Luckily, this was a relatively simple behavior. But I wouldn't want to do this for some of my more complicated trees.
     
  18. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Glad you got it working! What version did you upgrade from? I try to ensure the update process is as smooth as possible so I try to make it backwards compatible from the version at least a year ago if there were any serialization changes.
     
  19. bpolley

    bpolley

    Joined:
    Mar 18, 2014
    Posts:
    10
    The original version of Behavior Designer was 1.5.6
     
  20. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Hey folks,

    I wrote a task to handle Timelines from Behavior Designer and thought I would share. This is just my initial version and so far I'm only using it to play a timeline. You'll need to be using at least Unity 2017.1 since that's the version with Timeline. It appears the preferred method for using timelines is to have a Playable Director component on the gameobject you are manipulating with the timeline and that component is connected to a Timeline (which exists as an asset in your project). Or of course you could just wait for Justin to come out with what will sure to be superior tasks that take advantage of timelines. The nice thing about timelines is you could potentially replace numerous tasks on a tree with just a single timeline. It really just depends on how much stuff you build into the timeline.

    One other note is that I separate all of my custom tasks into their own task category so I can get to them quickly. Thus [TaskCategory("AllanTasks")] at the top of the class. Just comment out that line or change the name to something you prefer.

    Edit1:
    I made a change to the way tag searching is done if you decide to use a tag. I've always hated the idea of searching an entire scene for a tagged object, very inefficient. Now I search the hierarchy of just this transform (the transform with the behavior tree) for any PlayableDirector components, check the tag and then use that tagged Playable Director. This should let you have several Playable Directors and timelines associated with each character, each with a unique tag.

    Code (CSharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using BehaviorDesigner.Runtime;
    6. using BehaviorDesigner.Runtime.Tasks;
    7. using UnityEngine.Playables;
    8. using Tooltip = BehaviorDesigner.Runtime.Tasks.TooltipAttribute;
    9.  
    10. [TaskDescription("Manipulate Timeline from this task")]
    11. [TaskCategory("AllanTasks")]
    12. public class LLTimelinePlay : Action
    13. {
    14.     //Make sure you have a PlayableDirector Component on the gameobject this task is controlling
    15.     //Make sure you have a Timeline asset created and linked to the PlayableDirector component
    16.     //See Timeline Manual Preview here: https://docs.google.com/document/d/1gHmNTNIsn_yuzlURnaTFDxt24vf-8QyUcjtTgbZiKsk/pub
    17.     //See a bunch of other Timeline stuff here: https://forum.unity3d.com/threads/timeline-experimental-preview-release-1.455265/
    18.  
    19.     //Place PlayableDirector components on gameobjects attached to the character with this behavior tree and task
    20.     //This will allow you to assign a different PlayableDirector with designated Playable Timeline to this task
    21.     //You could also use Tags to find the PlayableDirectors but we'll just assign them for now
    22.     [Tooltip("Leave PlayableDirector null if using a tag")]
    23.     public PlayableDirector playableDirector;                                   //Leave this null if using a Tag
    24.     [Tooltip("Tag used on the gameobject with Playable Director component")]
    25.     public string playableDirectorTag;                                          //Tag used on PlayableDirector on this gameobject
    26.     [Tooltip("What do you want the timeline to do when it's finished, Loop, Hold etc.")]
    27.     public DirectorWrapMode wrapMode = DirectorWrapMode.None;                   //What do you want the timeline to do when it's finished, Loop, Hold etc.
    28.     [Tooltip("Timeline Starttime (If something other than at the beginning)")]
    29.     public float initialTime = 0f;                                              //Timeline Starttime (If something other than at the beginning)  
    30.     [Tooltip("Update Mode, See docs")]
    31.     public DirectorUpdateMode timeUpdateMode = DirectorUpdateMode.GameTime;     //Update Mode, See docs
    32.     [Tooltip("Tell the Timeline what to do")]
    33.     public bool timelinePlay = true;                                            //Tell the Timeline what to do
    34.     [Tooltip("Tell the Timeline what to do")]
    35.     public bool timelinePause;                                                  //"
    36.     [Tooltip("Tell the Timeline what to do")]
    37.     public bool timelineResume;                                                 //"
    38.     [Tooltip("Tell the Timeline what to do")]
    39.     public bool timelineStop;                                                   //"
    40.     [Tooltip("remain in this task until timeline has completed (if true, taskstatus will remain Running until timeline ends)")]
    41.     public bool stayInTaskUntilEnd;         //remain in this task until timeline has completed (if true, taskstatus will remain Running until timeline ends)
    42.     [Tooltip("stop timeline prematurely before it ends (may be a reason to exit this task before timeline ends)")]
    43.     public float timelineStopTime = 0f;     //stop timeline prematurely before it ends (may be a reason to exit this task before timeline ends)
    44.     public bool changeAnimatorToNormalMode;
    45.     private PlayableDirector[] playableDirectorTransArray;
    46.     private float timelineDuration;
    47.     private bool timelineIsDone;
    48.     public SharedBool breakOutOfTimeline;       //ability to exit out of this timeline based upon code from somewhere else
    49.  
    50.     public override void OnAwake()
    51.     {
    52.         //base.OnAwake();
    53.         if (playableDirector == null)
    54.         {
    55.             playableDirectorTransArray = transform.GetComponentsInChildren<PlayableDirector>();
    56.             foreach (PlayableDirector playable in playableDirectorTransArray)
    57.             {
    58.                 if (playable.tag == playableDirectorTag)
    59.                     playableDirector = playable.GetComponentInChildren<PlayableDirector>();
    60.             }
    61.         }
    62.     }
    63.  
    64.     public override void OnStart()
    65.     {
    66.         //base.OnStart();
    67.         if (playableDirector == null)
    68.             Debug.LogWarning("You must assign a PlayableDirector component on this task or at least use a tag");
    69.         else
    70.         {
    71.             //Set director defaults
    72.             playableDirector.extrapolationMode = wrapMode;
    73.             playableDirector.initialTime = initialTime;
    74.             playableDirector.timeUpdateMode = timeUpdateMode;
    75.  
    76.             if (timelinePlay)       //Play Timeline
    77.             {
    78.                 //if (changeAnimatorToNormalMode)
    79.                 //    animator.updateMode = AnimatorUpdateMode.Normal;
    80.  
    81.                 playableDirector.Play();
    82.                 StartCoroutine(WaitForTimelineToFinish());
    83.             }
    84.                
    85.             if (timelinePause && playableDirector.state == PlayState.Paused)    //Resume Timeline only if it is playing
    86.                 playableDirector.Resume();
    87.         }
    88.     }
    89.  
    90.     public override TaskStatus OnUpdate()
    91.     {
    92.         if (playableDirector == null) //If we don't have a PlayableDirector on this gameobject
    93.             return TaskStatus.Failure;
    94.  
    95.         if (breakOutOfTimeline.Value)
    96.         {
    97.             playableDirector.Stop();
    98.             return TaskStatus.Failure; //This could be success, it just depends on how you look at it.
    99.         }
    100.              
    101.         if (timelinePause && playableDirector.state == PlayState.Playing)       //Pause Timeline
    102.         {
    103.             playableDirector.Pause();
    104.             return TaskStatus.Success;
    105.         }
    106.         if (timelineStop && playableDirector.state == PlayState.Playing)        //Stop Timeline
    107.         {
    108.             playableDirector.Stop();
    109.             return TaskStatus.Success;
    110.         }
    111.  
    112.         if (timelineStopTime > 0 && playableDirector.state == PlayState.Playing) //Stop Timeline prematurely
    113.         {
    114.             if (playableDirector.time >= timelineStopTime)
    115.             {
    116.                 playableDirector.Stop();
    117.                 return TaskStatus.Success;
    118.             }
    119.             return TaskStatus.Running;
    120.         }
    121.  
    122.         if (stayInTaskUntilEnd)
    123.         {
    124.             if (timelineIsDone)
    125.                 return TaskStatus.Success;
    126.             else
    127.                 return TaskStatus.Running;
    128.         }
    129.         else
    130.             return TaskStatus.Success;
    131.     }
    132.  
    133.     IEnumerator WaitForTimelineToFinish()
    134.     {
    135.         timelineDuration = (float)playableDirector.duration;
    136.  
    137.         yield return new WaitForSeconds(timelineDuration);
    138.  
    139.         timelineIsDone = true;
    140.     }
    141.  
    142.     public override void OnEnd()
    143.     {
    144.         //base.OnEnd();
    145.         //if (changeAnimatorToNormalMode)
    146.         //    if (animator.updateMode == AnimatorUpdateMode.Normal)
    147.         //        animator.updateMode = AnimatorUpdateMode.AnimatePhysics;
    148.     }
    149. }
    150.  
    151.  
     
    Last edited: Jul 25, 2017
  21. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    This is AWESOME - thanks for sharing! I've also posted about it in a custom tasks thread on the Opsive forum so it doesn't get lost :)
     
  22. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    Did you try to import Behavior Designer Movement Pack? I still get the errors even after I delete the folder and download it again from Asset Store.
     
  23. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Yes, I just tried again to verify and am not getting any errors with 2017.1. I also haven't received any other reports of this which I thought that I would have by now. Did you remove the Movement Pack from the Asset Store download cache to ensure you are getting the most recent version?
     
  24. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    That must be it. This didn't come to mind since Asset Store usually detects if there is new version, or so I've thought. Thank you again!
     
  25. lorddanger

    lorddanger

    Joined:
    Aug 8, 2015
    Posts:
    103
    I am completely new here.
    I want to know that is search by tag is there?
     
  26. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Yes, Behavior Designer contains both FindWithTag and FindGameObjectsWithTag tasks to be able to search by tag.
     
  27. SamuelGoldenbaum

    SamuelGoldenbaum

    Joined:
    May 21, 2017
    Posts:
    47
    Any reason this would not integrate into a deterministic environment? We have game replays that need to be deterministic to play across the various platforms.
     
  28. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    It should work - the behavior tree traversal is deterministic as long as you aren't using a task which uses a random value.
     
    SamuelGoldenbaum likes this.
  29. SamuelGoldenbaum

    SamuelGoldenbaum

    Joined:
    May 21, 2017
    Posts:
    47
    Thanks Justin
     
  30. SamuelGoldenbaum

    SamuelGoldenbaum

    Joined:
    May 21, 2017
    Posts:
    47
    Can I assume the same for the other two packs: movement and formation?
     
  31. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Yes - the actual tasks are deterministic and then it's up to the underlying pathfinding implementation (NavMesh, A*, etc) to do the movement. I haven't tested the pathfinding implementation to see if it is deterministic but if it's using a standard pathfinding algorithm then it would always take the shortest path from that point.
     
  32. MitchStan

    MitchStan

    Joined:
    Feb 26, 2007
    Posts:
    568
    Hey Justin,

    The more I use Behavior Designer, the more I am blown away by it's ease and brilliance. Amazing asset you have created. I really appreciate the abort type feature in the composite tasks. I'm getting the hang of using this feature and it really simplifies the tree structure. Wonderful stuff.

    A little while back you helped me with creating a new shared variable for an animation curve. That has worked out extremely well for me. Thank you. So now I am using a Generic List in one of my custom tasks, List<Vector3> intersections. How could I, if it's at all possible, make a custom SharedList<Vector3> intersections?

    Thank you in advance for you excellent help.

    Mitch
     
  33. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Very happy to hear that! Conditional aborts are extremely useful :)

    Something like this?

    Code (csharp):
    1.  
    2.     public class SharedVector3List : SharedVariable<List<Vector3>>
    3.     {
    4.         public static implicit operator SharedVector3List(List<Vector3> value) { return new SharedVector3List{ mValue = value }; }
    5.     }
    6.  
     
  34. MitchStan

    MitchStan

    Joined:
    Feb 26, 2007
    Posts:
    568
    Yep. That looks about right. I'll try it out today and let you know how it goes. Thank you for your help.

    Mitch
     
  35. MitchStan

    MitchStan

    Joined:
    Feb 26, 2007
    Posts:
    568
    That worked perfectly! Thank you, Justin!
     
    opsive likes this.
  36. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @opsive Before digging into the source code, I'm wondering just how difficult it is to completely remove the navmesh code from the movement pack? I would like to have units doing tactical formations and seeking targets, but not have to ever reference a navmesh agent to do so. But perhaps the navmesh agent is the only palce where actual movement takes place?
     
  37. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    You'll want to follow a similar strategy that the Movement Pack uses for the other pathfinding implementations. All of the various implementations have a class which derives from the Movement class, and then the child classes (seek, evade, follow, etc) derive from this new class. In your case you'd have some like the following

    Seek - > SteeringBehaviorMovement -> Movement

    This will prevent you from needing the NavMeshAgent at all.
     
  38. lorddanger

    lorddanger

    Joined:
    Aug 8, 2015
    Posts:
    103
    Hello ,
    How random patrol location/waypoints can be generated instead of fixed way points ,
    like I want my NPC to wander/partol randomly in about 40 units radius from its spawn point
     
  39. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    The Wander task will get you pretty close, except it doesn't have a radius to restrict the movement. This part could be added by modifying Wander.OnUpdate.
     
  40. lorddanger

    lorddanger

    Joined:
    Aug 8, 2015
    Posts:
    103
    Hello ,
    After installing Behavior Designer and Movement Pack every time I update any scripts every thing in editor turns red upload_2017-8-9_16-50-53.png
     
  41. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    It looks like something went wrong with the package importer and changed the styles. Behavior Designer doesn't do anything with the import pipeline so it could be that something else is occurring. I would create a fresh project and try it from there.
     
  42. lorddanger

    lorddanger

    Joined:
    Aug 8, 2015
    Posts:
    103
    OK I will update if I find and anything
     
  43. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I'm not sure I understand completely. But with this approach, would I still be able to take advantage of all the add-on packs capabilities? For example, I have the Tactical Formations pack and I want my enemy ships to follow these attack and movement patterns, but I don't want it to need a navmesh or care whether or not it's oriented in 2D space instead of 3D space. Could that be done relatively easily?
     
  44. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Yes, with the Tactical and Formations Pack if you subclass TacticalGroup/FormationsGroup to add your own steering behavior you'll still get the benefit of the orderings/groupings.
     
  45. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Any chance you might consider adding this sort of thing as a built-in feature?
     
  46. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Previous versions of the Formations Pack actually had a steering behavior subclass but was removed because I took a poll and nobody was using it. Since then the Formations Pack was refactored so the old code won't work, but if I get enough requests to add it back again I definitely can.
     
  47. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    OK, thanks. I might give it a try myself for the Tactical pack and if it works out then I'll buy the formations pack and try it there as well. I will probably need your help along the way.
     
  48. lorddanger

    lorddanger

    Joined:
    Aug 8, 2015
    Posts:
    103
    Update the red Text issue was with unity 5.6.0 updated and working fine
    Now
    upload_2017-8-12_6-58-31.png

    This Just I was Testing out with DB , I am little confused that how to stop the NPC when it passes the Radiar Tags (Within Distance Modified) and seek Reached the target
    And Start Partol Vector 3 (Modified Partol) again when the target moved or Killed or Deleted

    One way would be using Restart When Complete
    When checked : It doesn't stop after reaching the target it moves to Patrol Vector 3
    When Checked off : It stops when Seek completes but doesn't start back again if the target moves or killed etc

    And also do update the variables of DB from external MonoBehaviour
     
    Last edited: Aug 12, 2017
  49. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    You'll want to leave Restart When Complete unchecked and when you want the behavior tree to start again you can call BehaviorTree.EnableBehavior.
     
  50. lorddanger

    lorddanger

    Joined:
    Aug 8, 2015
    Posts:
    103
    Ok thanks