Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Behavior Designer - Behavior Trees for Everyone

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

  1. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I am wondering if this is too much to ask for, but I am trying to make the can see object based on the gameObject's transform that I want it to be based on.

    I have head object that is basically rotated -90 on x axis because I am making top down game with 2dtoolkit. 2dtoolkit does not allow xz plane but I have manual rotation to make it work with xz plane.

    Thing is, current canseeobject can't handle it. I have tried to supply my custom transform into code , but they alone was not good enough.

    I also tried to make the base head object which is effectively making it compatible to current canseeobject, but that has problem of its own. It can't be animated well to rotate the heads around, because it now requires to rotate on all 3 axis.. and it is impossible to deal with it.

    I am wondering if it is somehow possible to supply my own transform to the canseeobject and it still works as it is now.

    I want to have head looking around animation which can animate where AI is looking. (not just looking straight forward)
     
  2. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    The icons are stored in BehaviorDesignerEditor.dll so you could use something like ILSpy to view the package and the image names. Other than that, the task list documentation has an image of each task with its icon so you can use that for a visual reference. The name of the icon just follows the format {SkinColor}{TaskName}Icon.png. {SkinColor} is parsed by the editor so an example icon name would be {SkinColor}Sequence.png. The actual tasks have the name of the image as well within the TaskIcon attribute.

    The Can See Object uses the transform of the GameObject that the behavior tree is on. If you want to change it you can change the MovementUtility.WithinSight function call to use your own specified transform, such as:

    Code (csharp):
    1.  
    2. objectInSight.Value = MovementUtility.WithinSight(targetTransform.Value, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, objectLayerMask, obstructionLayerMask)
    3.  
    Where targetTransform.Value is a SharedTransform. This is using the modifications from a few days ago.
     
  3. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    A new version of Behavior Designer and the Movement Pack should be on the store soon. It's looking like Unity 5 could be released this week and you have to upload a Unity 5 package to prevent any compatibility warnings from appearing. I decided to add some of the version 1.5 fixes to this version just to get it out sooner. You can see the full release notes here. The Movement Pack is exactly the same as before.
     
  4. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I would like to create a branch on my tree which runs forever and just update some values on my animator. At the moment, I do this by having a separate BT and just set it to repeat forever. (using repeat task)

    However, I was wondering if this can be done in my main AI tree. I have tried to use parallel but repeat node on the animation branch is probably returning a running status and so it only runs the other branch once. Is there way to make a branch of my tree to run at every tick no matter what but also still try to evaluate the other branch as normal?

    At first it seems like it should be easy as using normal sequence and let the whole BT to run every tick but the thing is my other main AI branch can also be returning running as well..
     
  5. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Also, is there any tickDelta value that I can use in my task? If I set it to run fixed update or anything else, I need to know what value is equal to Time.deltaTime.. ?
     
  6. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    You can set a Parallel task as your root task and do all of your update within one branch and then have the rest of the tree in the other branch. Take a look at this documentation topic - it gives a lot of detail behind my thought process for designing a complete behavior tree for our newest asset, the Third Person Controller. Close to the top of this tree I do something similar in that the health SharedVariable is updated every tick parented by a Repeater task.

    Time.deltaTime will work, or since you are updating within FixedUpdate you can use Time.fixedDeltaTime.
     
  7. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    If I bought it directly from the website how do I download the Unity 5 package?
     
  8. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    You already have it :) There isn't a difference between the Unity 4 package and the Unity 5 package. I had to submit a Unity 5 specific package to the Asset Store because there's a chance that the Asset Store could warn new purchases that Behavior Designer isn't compatible with Unity 5 when in fact it is. Submitting a Unity 5 specific package prevents this warning from appearing. I probably should have just left this line off of the release notes because it doesn't affect current customers at all.
     
  9. MIK3K

    MIK3K

    Joined:
    Sep 10, 2014
    Posts:
    144
    Hi Opsive - Is there a change to the format of Unity 5 asset packages? Specifically, the motion pack from you and the samples and integrations from your website I used to be able to double click and they would open in Unity, but doesn't seem to associate Unity 5 with those asset packages now. I have a bad habit of breaking most things I touch so I figured I better ask before I try to "open with" Unity 5.

    I threw out all my Unity 4.6xx learning projects and starting brand new with the wonderful new Unity 5.

    Thanks
     
  10. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    I moved all of the task integration downloads to the samples page but that's it - most of the sample projects don't need to be updated for Unity 5. The Asset Store version of the Movement Pack does have a Unity 5 version but that is just because the nav mesh needed to be baked again - the format shouldn't have changed.
     
  11. MIK3K

    MIK3K

    Joined:
    Sep 10, 2014
    Posts:
    144
    Got it halfway figured out. I just have to open custom assets from inside Unity with the assets > import package > custom package. Somewhere along the line of installing Unity 5 and uninstalling 4.6 I lost that file association where I could just use Windows Explorer to find the asset and double click to load it into a currently open project. I tried associating it with Unity but it wants to start a new project if I do it that way with each asset. Not a big deal just doing it through Unity itself.
     
  12. OnePxl

    OnePxl

    Joined:
    Aug 6, 2012
    Posts:
    307
    Can't you just drag and drop the asset file onto the Unity window? If that fails, I think you can even place it in the Assets folder and it will appear in the Project tab, then you can double click within Unity to import.
     
    MIK3K likes this.
  13. MIK3K

    MIK3K

    Joined:
    Sep 10, 2014
    Posts:
    144
    Thanks, dragging and dropping worked perfectly! Behavior designer has a lot of nice 3rd party integrations and samples and that is a lot less tedious.
     
    OnePxl likes this.
  14. SimStm

    SimStm

    Joined:
    May 24, 2013
    Posts:
    44
    Hi. I'm planning to do a Tycoon game, just for research/study purposes, and my "game" may have things like in Rollercoaster Tycoon or Theme Park, who the AI will be walking randomly in the area, but sometimes she will walk to a building to purchase item X/Y/Z, getting into a queue waiting for something and even grouping with another AI's (inside an area for example) to "watch" an panel/show/fireworks or whatever they will watch (haha).

    I've already done the "building things according to a grid" part, and I want to setup some AI to wander by the demarked area.

    Your tool can help me to create some of these "more complex" possible AI behaviors too?

    By the way, awesome tool. Thanks.
     
  15. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    Thanks for taking a look at Behavior Designer.

    Yes, you definitely can make a tycoon game with behavior trees. As a starting point, take a look at this tree which gives an example of one way to structure your tree. In this tree the highest priority items are to seek health or ammo if the agent needs health or ammo. In your situation you would instead have the agent seek a building to purchase an item, or wait in a queue for a ride. When the agent doesn't have anything to do it would then wander.
     
  16. yumianhuli1

    yumianhuli1

    Joined:
    Mar 14, 2015
    Posts:
    92
    Hi,I have a question with OnCollisionEnter funcion by using behavior designer.
    how can i use OnCollisionEnter funcion like normal script in behavior designer?
    Hope your answer,thank you!
     
  17. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    You can use the conditional task Has Entered Collision to determine if a collision has occurred. This post has an example of using the Has Entered Trigger task but you would use the collision version in a very similar way.
     
    yumianhuli1 likes this.
  18. yumianhuli1

    yumianhuli1

    Joined:
    Mar 14, 2015
    Posts:
    92
    Thank you for your help!But can you write a sample task (conditional point)for Entered Collision/Trigger in your new version?
     
  19. yumianhuli1

    yumianhuli1

    Joined:
    Mar 14, 2015
    Posts:
    92
    I created a simple FPS demo ,AI like below in behavior designer.I know it just play once,but it works!The enemy was attacked.
    entry
    IIIIIIIIIIIIIIIII -seq
    IIIIIIIIIIIIIIIIIIIIIIIIII -has seen
    IIIIIIIIIIIIIIIIIIIIIIIIII -moveTo
    IIIIIIIIIIIIIIIIIIIIIIIIII- attack

    So,I added a reapter point on it for loop!

    entry
    IIIIIIIIIIIII -reapter
    IIIIIIIIIIIIIIIIIIIIIIIIIIIIIII -seq
    IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII-has seen
    IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII-moveTo
    IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII- attack
    The result is nothing happened?After adding a reapter point ,Behavior tree did not work, Why? Please help,thank U!
     
    Last edited: Mar 15, 2015
  20. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    Sure, I definitely can.

    By just adding a repeater task it shouldn't have stopped the agent from attacking. Have you downloaded the RTS sample project? It gives an example of where the agent will move to a target and attack. The Playmaker, UFPS, and Third Person Controller trees also give an attack example but those require a separate asset.
     
    yumianhuli1 likes this.
  21. yumianhuli1

    yumianhuli1

    Joined:
    Mar 14, 2015
    Posts:
    92
    Hi,the attack task has returned success(green), it means the agent's attack has completed,right?So the repeater task should work I think,but no reaction in behavior tree...I do not know why...thank U!
     
  22. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    Can you send me your tree? I should be able to tell you pretty quickly why it is doing what it is doing. It is tough to say just based off what you are describing - the only thing that the repeater decorator does is execute its child again after the child has finished executing. This wouldn't prevent your attack task from attacking. You can send your tree to support@opsive.com
     
    Last edited: Mar 15, 2015
  23. yumianhuli1

    yumianhuli1

    Joined:
    Mar 14, 2015
    Posts:
    92
    hi,I have done.Just not selected Restart When Complete.So sorry.I am just a new learner,but very like your AI software,SO GOOD.em,next,Can you tell me about the shared Variable,I do not know why using it and how to use it.
     
  24. MikeTon

    MikeTon

    Joined:
    Jan 10, 2013
    Posts:
    57
    I'm trying out the Vectrosity integration and demo, and are not able to get it running.

    I got errors on import with the following lines on almost all the Vectrosity task scripts.

    The following snippet is from SetRay3D.cs OnStart() =>

    if (storedVectorLineReference.IsShared) {
    //var vectorLineReference = vectorLine.vectorObject.AddComponent<VectorLineReference>();
    //vectorLineReference.vectorLine = vectorLine;
    //storedVectorLineReference.Value = vectorLineReference;
    }

    screen-capture-3.jpg

    I had to comment out those 3 lines to make it work. Any suggestions on how to proceed would be much appreciated. I'm really digging Behavior Designer so far.

    And thanks for your time and consideration.

    -Mike
     
  25. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    Hey Mike,

    It's great to hear that you are enjoying Behavior Designer so far. It looks like the Vectrosity integration was from Vectrosity 3 versus Vectrosity 4. The API in Vectrosity 4 changed a bit so the tasks stopped working. I just uploaded a new version to the samples page that works with both Vectrosity 3 and Vectrosity 4. When you update those errors should go away.

    Justin
     
    MikeTon likes this.
  26. MikeTon

    MikeTon

    Joined:
    Jan 10, 2013
    Posts:
    57
    This rocks Justin. It looks like Vectrosity 4 uses unity GUI, so the fix went from :

    //var vectorLineReference = vectorLine.vectorObject.AddComponent<VectorLineReference>();
    varvectorLineReference = vectorLine.rectTransform.gameObject.AddComponent<VectorLineReference>();

    Props on figuring that out so fast!

    I am having one bit of an issue though, in the demo file tree looks like this:

    screen-capture-4.jpg

    Any thoughts on how to fix the "Unknown Destroy" node? I'm still making my way through Behavior Tree, so even minor things are tripping me up. Thanks for your time and consideration.

    -Mike
     
  27. MikeTon

    MikeTon

    Joined:
    Jan 10, 2013
    Posts:
    57
    Also, as a heads up, for the DoTween integration, it looks like the newest version of DoTween has updated a number of commands, so you may get users report the following types as broken:

    screen-capture-5.jpg


    It appears that:

    //DG.Tweening.DOTween.Kill(); //0 argument overloads affecting all tweens are no longer valid
    DG.Tweening.DOTween.KillAll(); //<= this appears to be the new convention?

    Let me know if I'm mistaken. I fixed it locally and it appears to work fine.

    Thanks.

    -Mike
     
  28. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    Did you happen to modify the tree before you imported the Vectrosity tasks? If you do that the tree will serialize and save any missing task references along with it. The fix is really easy though - just download a fresh sample scene from the website and you should be good to go.
    Thanks for letting me know. Which version of DOTween are you using? The Asset Store still says 1.0.030 and the current integration tasks work for that. I'll be ready to update them though when I see that there is a new version on the Asset Store.
     
  29. khan-amil

    khan-amil

    Joined:
    Mar 29, 2012
    Posts:
    206
    I recently updated the package to version 1.4.7, and found out the feature to block editing of prefab instances.
    It's great to have that, but I think too much options have been cut on the instance side.

    Mainly, I'd like to be able to right click>Edit script, locate script and Expand/collapse.
    Depending on how/what you serialize the last one could be more work, but the first two shouldn't change anything I think.

    Nothing major, but it's just a pain to have to select the prefab instance just when I want to check/change a piece of code.
     
  30. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    That's a good point. I'm in the middle of version 1.5 development and you'll be able to open/locate the script while the tree is in view only mode. I would allow you to collapse the task as well but unfortunately it does require serialization so that has to stay how it is.
     
  31. MikeTon

    MikeTon

    Joined:
    Jan 10, 2013
    Posts:
    57
    Cool, reimporting fixed it : I must have modified before importing the tasks.

    And my DOTween version is 1.0.310, the latest available from Demi's source site...it looks like the asset store one is a few versions behind.

    Anyhow thanks for all of your help so far. I really appreciate your efforts.

    -Mike
     
  32. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    We have all but finished Behavior Designer 1.5 and it should be released within a couple of days. Just need to finish testing it and replacing the placeholder graphics. With that said, if you're interested in helping test it please get in contact with me. I already have a couple of people looking at it but this version contains some startup optimizations so the more trees that it runs on the better.

    I have also completed integration with Adventure Creator. For this integration, a lot of the functionality comes from allowing Adventure Creator to talk to Behavior Designer. I haven't used Adventure Creator other than for this integration so let me know if you think that any more actions/tasks are needed:

    Adventure Creator Actions:
    Send Event (yes, a native event system is a new Behavior Designer 1.5 feature)
    Start Tree
    Stop Tree
    Synchronize Global Variables

    Behavior Designer Tasks:
    Synchronize Bool
    Synchronize Float
    Synchronize Int
    Synchronize String
     
    OnePxl likes this.
  33. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    Behavior Designer 1.5 has been released! This version contains a ton of improvements and you can see the change list here. Here are the more visual highlights:

    Built in event system
    Event.png
    Send Event and Has Received Event tasks have been added. Send Event will allow you to send an event specified by a name to any behavior tree. Has Received Event will then return success as soon as it has received the event. You can also trigger the events through code. The documentation page for the event system is located here.

    Local behavior tree can override the external behavior tree variables
    LocalVariables.PNG
    In the past you could override your external tree variables by selected the "Automatically Inherit Variables" option on the Behavior Tree Reference task. However, when you specify a behavior tree via the "External Behavior" property on the Behavior Tree component you weren't able to override the variables. With the latest release you are now able to. The screenshot above is of a tree which has an external tree specified on the behavior tree component. As long as the variable name and type match, the external tree's value will be overridden by the local trees variable value. In this example, the value of "My String" will be local and the value of "My Bool" will be false when the tree starts.

    The task that triggers a conditional abort or interruption is highlighted
    ConditionalHighlight.png
    When a conditional task or interrupt task triggers a conditional abort or interruption, the task will momentarily have its borders highlighted. This allows you to quickly identify which task caused the change.

    There have been a lot of other changes so make sure you take a look at the change lsit. Things such as startup optimizations and being able to add OnFixedUpdate and OnLateUpdate to your tasks are important improvements but they aren't too visual so I didn't list them here.
     
    tosiabunio likes this.
  34. deis

    deis

    Joined:
    Sep 17, 2009
    Posts:
    29
    I wish there was an easy way to search this thread for this info, but anyway...

    Is there a recommended way to pass or share variables between Behavior Trees. I have an initialization tree that loads up some data about the scene the GameObject is in and then executes a "Start Behavior Tree" to change to the main behavior tree that handles the primary logic such as patrolling waypoints and looking out for targets. If a target is found, I want to then activate another behavior tree that handles the fight logic, but what is the best way to pass variables between the trees on an object? I do not want to have all of that logic inside of a single tree obviously.
     
  35. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    That's actually one of the reasons why we started our own forum - it makes searching a ton easier and by now there have been a good amount of posts to be able to search on.
    There are a few different ways you could approach this -
    1. Use global variables. This may not make sense if you have multiple agents but it will work well for a single agent
    2. Use external trees. This would allow you to have all of your primary logic in an external tree that only gets loaded when the tree starts. Of course, you may not want to organize your trees this way.
    3. Use the Variable Synchronizer component. You can synchronize between two behavior trees and that will keep the two variables continuously updated.
    3. Use the updated Start Behavior Tree task :) If you enable synchronizeVariables it will synchronize the variables from the calling behavior tree to the called behavior tree.
     

    Attached Files:

    deis likes this.
  36. deis

    deis

    Joined:
    Sep 17, 2009
    Posts:
    29
    I don't know how my brain completely missed that Forum link your website, I feel a fool now. LOL

    Thankyou very much for the info and the new StartBehaviorTree.cs class. These will go a long way. I will relocate over to the forum if I need anymore info.

    Thanks!
     
  37. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    Hi, Congrats on new release.
    Just for my paranoia (before upgrading), can you confirm something I'm pretty-sure about regarding this from the change list:

    I want to ensure my stuff's not all about to break...

    This only relates to external trees (e.g. filled in via inspector) and only on some conditions (e.g. the duplicate entries you talked about above)?

    Specifically, my agents have local tree each, each with lots of tree references to other trees. All of these have variables. I expect my values to cascade down (i.e. values set in one's local tree override values set in the referenced trees). Right? (checking phrasing of "external tree variables" vs. "referenced tree variables".)

    I believe I'm doing what's intended so suspect it won't have changed. Thanks.
     
  38. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    That specific feature relates to when you have an external tree specified within the External Behavior property of the behavior tree component:

    external.PNG

    The other new feature that 1.5 brings is the fact that you no longer have to select "Automatically Inherit Variables" within the Behavior Tree Reference task. So there were two separate but related changes - one dealing with the External Behavior property on the Behavior Tree component and one dealing with the Behavior Tree Reference task within the behavior tree.

    Based on your description I think that you should be safe to update, it will now automatically override the variables without you having to think about it.
     
    Arkade likes this.
  39. khan-amil

    khan-amil

    Joined:
    Mar 29, 2012
    Posts:
    206
    Hey, ran into a bug today, it seems like deleted stuff can't be undone.

    Another stuff is that, when copy/pasting a group of tasks, the state of the tasks in the tree were all set to enabled, even if some were disabled in the original selection.

    Could you add a button that automatically selects the editable behavior tree coresponding to the one currently opened?
    It's great that now editing is locked on prefab instance or when using external trees, but it's tedious when testing stuff :
    - edit something on the prefab
    - hit play
    - select the actual instance in the scene to see how the tree reacts
    - exit play
    - now you're on your tree, you know what to fix, and try to do so, only to be reminded when clicking that you can't actually edit stuff, because you've selected the instance.

    So yeah, anything to differentiate more when we can't edit the tree, and if you could add a quick way (quicker than the drop-own, if possible) to jump to the editable asset, that would be helpful.
     
  40. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    Can you explain more on this? Undo/redo should work for deleting tasks.

    Thanks, the disabled state will be correctly copied in the next version. I also added the collapsed state.

    I have actually been thinking about this a good amount recently. If you've visited the tree before you can use the forward/back buttons but that is only for trees that you've visited. I'm trying to work out a quick way to jump to any related tree. For example, even if you are on the external tree I'd like you to be able to quickly move to any tree that references that external tree. I'm still trying to some up with a good way to handle this so if you have any ideas I'd love to hear them.
     
    twobob likes this.
  41. RealAspireGames

    RealAspireGames

    Joined:
    Dec 24, 2013
    Posts:
    265
    Hello!
    I am using behavior designer for Realistic FPS Prefab asset! I have imported the 3rd party support packages from your website! I followed the steps that it told me to do like change the class to public! I am trying to get the AI's to shoot at targets to look like they are doing target practice but it is not working the AI just stands there on the idle animation and does nothing! What am I doing wrong? It gives me this error

    NullReferenceException: Object reference not set to an instance of an object
    BehaviorDesigner.Runtime.Tasks.RFPS.Shoot.OnStart () (at Assets/Behavior Designer/Third Party/Realistic FPS Prefab/Tasks/Shoot.cs:26)
    BehaviorDesigner.Runtime.BehaviorManager.PushTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex)
    BehaviorDesigner.Runtime.BehaviorManager.EnableBehavior (BehaviorDesigner.Runtime.Behavior behavior)
    BehaviorDesigner.Runtime.Behavior.EnableBehavior ()
    BehaviorDesigner.Runtime.Behavior.Start ()


    Please Help!

    -Thank you.
     
  42. khan-amil

    khan-amil

    Joined:
    Mar 29, 2012
    Posts:
    206
    There's nothing much to say unfortunately ^^; I just tried it again. I get my behavior tree (external tree, if that makes any difference for you), then right click>add task>composite>sequence(for example). I select the newly created sequence, then delete it. After if I hit ctrl+z, nothing happens. If I have moved the camera before hitting ctrl+z, the camera stick back to the default center position, but the action isn't re-created.

    Great, that will be usefull as well ^^
    Another thing with the disabled states : is it possible to have them ignored by your compiler (or whatever you call the thing that checks for errors in the trees)?
    Unless there are ways and use for dynamically enabling/disabling states, I can't think of any scenario where having a disabled sequence with no child should prevent the execution of the rest of the tree.



    To visually differentiate the editable or not trees, I think you could play with the background, replacing the grid with something like warning stripes (like http://www.psdgraphics.com/wp-content/uploads/2010/04/hazard-stripes-texture.jpg , colour may be too much, the different pattern should be enough.)

    As for navigation yeah, for now it's rather cumbersome.

    This is only a test scene, with a handful of copy-pasted ennemies, so I don't see this way of getting stuff scaling well. Playmaker does kind of the same thing if I remember right, and it's a pain as well when you have a bunch of ellements on the scene.

    Maybe you could follow the standards of unity? When you select an asset, a pop-up window opens, where you have 2 tabs, one with the scene elements, and one with the assets. This way you could quickly regroup things that are editable or not. You could then add a third tab, with only "related" trees. Like if you're on an external tree, you get the gameobjects referencing it in the scene or in prefabs?
    I think having a button on your navigation bar "Get editable tree", that would automatically open the corresponding editable tree for the current behavior would already help a lot.
     
  43. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    Before that error, did you previously get an error that said "Error: Unable to find the AIAgent component on ___"? It doesn't look like the targetGameObject GameObject has the AIAgent component added to it. Make sure this component exists on your RFPS agent.

    I just tried the following:
    1. Create a new external tree
    2. Add the sequence task
    3. Select the sequence task and delete
    4. Hit ctrl+z

    The sequence task was added back again. By any chance are you running an older version? There were some undo/redo improvements in one of the 1.4.x releases.

    Good point, I'll remove the disabled states from the error checker.

    hmm yeah the color would definitely add too much, but I can try playing with different patterns.

    Going along those lines, what if there was another popup navigation bar that had all of your related trees. It would have a header describing the category and then allow you to jump to that tree. Something like:

    External Trees

    ReferencedExternalTree1
    ReferencedExternalTree2
    Parent Trees
    ParentTree1
    ParentTree2

    This would make navigating between the view only tree and the referenced tree two mouse clicks away, and then you could easily move back to the tree that is referencing it with two mouse clicks as well. It would all be in the navigation bar so you would haven't to move your mouse too far either.
     
  44. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    The Behavior Designer - Formations Pack has been submitted to the Asset Store!

    bigweb.png

    The Formations Pack contains 15 different behavior tree tasks focused on group formations with Unity's NavMesh. More details about the Formations Pack can be found in this thread.
     
  45. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    Behavior Designer 1.5.0.1 has been released on the Asset Store and an email has been sent to opsive.com purchases. This is mostly a bugfix release and you can view the full release notes here. I did add a couple of minor features though with one of them being the ability to send parameters with events. Love/Hate integration has also been added.
     
    TonyLi likes this.
  46. Jiraiyah

    Jiraiyah

    Joined:
    Mar 4, 2013
    Posts:
    175
    Hi
    I have a question, is it possible to add sub trees to a tree during run time from code or not?
     
  47. Jiraiyah

    Jiraiyah

    Joined:
    Mar 4, 2013
    Posts:
    175
    Hi
    I have a question, is it possible to add sub trees to a tree during run time from code or not?
     
  48. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    Yes - if you subclass the BehaviorTreeReference task you can then override GetExternalBehaviors which will be called when the tree loads. This will allow you to dynamically switch out the trees during runtime.
     
  49. khan-amil

    khan-amil

    Joined:
    Mar 29, 2012
    Posts:
    206
    Sorry about the late answers.
    I'm on 1.5, and it happens as well when I add then delete a node on a tree from a prefab.

    Could be interesting yeah. Another thing I noticed recently is that I have the reflex of right clicking inside the view when I want it to get the prefab version of my tree. Is there anyway that could be implemented?
    Since the right click menu is already different, and it's usually that that shows me I'm not on the good tree (because I can't add nodes), it would be great to be able to switch from there as well.


    I've just ran into a design issue (I think?) related to conditionnal aborts.
    e5a6e865bbb02f3bc9da397ef48d9495.png

    Here the "Charge" action basically just tells the AI to navigate to it's target and always returns running, assuming that it'll eventually pass on another branch due to players action, or when getting close enough to the player, checked here in the "Grab" branch.
    The green check on "Is In range" shows that it's indeed checked against, and logs in my code shows that as well. However, if it fails once the "Grab Attack" action, it doesn't try it again. So, is this the way it's supposed to go? And if so, how should I proceed to make it re-try the GrabAttack action while "IsInRange" is true?
    For now I've put a "until success" above GrabAttack, and that more or less does the trick. Down the line I'll refactor the charge action so that I can chain the grab to it as it should be, but if you could enlight me on what I misunderstood about this setup, that would be great.
     
  50. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,130
    I just tried it with a prefab and you're right, it didn't delete correctly. Thanks, I'll make sure it's fixed for the next version

    That's an idea, there could be a whole submenu used to help navigate to the relevant tasks. This list of trees could be the same list of trees that appears in the toolbar up top.

    A conditional abort is only going to trigger when the conditional task status changes. This means that the abort is only going to trigger if the conditional task goes from success to failure or failure to success. When Grab Attack fails, the conditional abort isn't going to trigger again because it doesn't know anything about the Grab Attack task. Since that conditional task still returns success that abort will not trigger.What is the reason why Grab Attack is failing? Could you do a check ahead of time to ensure it will succeed? This would then be a conditional task that you can use conditional aborts with.
     
    twobob likes this.