Search Unity

Behavior Designer - Behavior Trees for Everyone

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

  1. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    running Unity Pro with Playmaker installed
     
  2. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    As a test, try to see if you can add it within a fresh project. It sounds like there is a class conflict. Make sure your custom classes are in a namespace
     
  3. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    I'm at work now... ( Animation lecturer ) & managed to get it up & running on the machine here no prob. So will try a new project once I get home this evening.
     
  4. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    280
    I'm receiving the following exception when stopping the game in the editor:

    It doesn't break anything, but it's annoying.
     
  5. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Are you using the latest version of the Movement Pack? Can you list the steps to reproduce?
     
  6. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    We are at Unite in LA! If you're also here make sure you stop by our Asset Store booth on Wednesday to say hi!

    IMG_5028.JPG
     
  7. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    280
    Yes, I'm using the latest version.

    I'm not 100% sure yet, but it might have to do using external behaviours which come from asset bundles, need to investigate this further. The behaviour itself is very basic (Entry -> Wander).

    p.s. Could you change the MovementUtility.WithinSight(Transformtransform,Vector3positionOffset,floatfieldOfViewAngle,floatviewDistance,GameObjecttargetObject,Vector3targetOffset,boolusePhysics2D,floatangleOffset2D,outfloatangle,intignoreLayerMask) access modifier to public in your next update? I'm using a Trigger approach instead Physics.OverlapSphere and would like to use this method for it.
     
  8. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Definitely.
     
    silentneedle likes this.
  9. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Opsive,

    I'm using current release Unity 5.4.2 on PC with the current release of Behavior Designer.
    I wanted to report something I've found. It's sort of a bug but it can be avoided. And it is amazingly annoying.
    You may already be aware of this.

    If I have any task attached to the tree that requires populating a string field in the Behavior Designer Inspector there is huge delay that locks up Unity as I type the letters. I can type the entire word and then Unity sort of locks up as the letters very slowly populate the field. Each letter creates a greater delay so that s single word may pause the Editor for a minute or so. It's so bad, I've just gotten used to disconnecting any task from the tree before I make entries into any string fields. As long as the task is disconnected from the tree, I can easily and quickly type the letters into the string field. Once the task is connected, there is a massive delay entering letters into the string field. My entire tree right now is in the scene. In other words, I'm not using any external behaviors in my tree.

    I have some StringList variables that I use to share Animator State names across tasks and dealing with those is very problematic. In a few cases, I've crashed Unity and thought I corrupted my Behavior Tree by changing the number of items in the list. It's a problem because it's hard to remember which tasks I have in the tree that are accessing each StringList. And forbid that I accidentally start editing the strings in those lists before disconnecting all accessing tasks from the tree.

    My guess is this has something to do with how unity serializes strings or it may only crop up once you have a sizable tree. I'm not sure because I really don't know anything about Custom Editor development. But as far as I can tell it's unique to string fields.

    Thanks
    Allan
     
  10. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    What serialization type are you using? Have you tried switching between JSON and binary? I have heard of prefabs using binary serialization have a similar problem. This is related to a bottleneck in Unity when you set a large binary blob of a prefab to dirty. The workaround is to use JSON until you need to switch to binary for speed.
     
  11. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Man I have no idea what dirty means (at least in regards to game development), what constitutes a large binary blob or what JSON and binary serialization is.

    It sounds like fun stuff though. :)

    So I have no way of knowing if I am using any particular serialization type. I honestly don't even know that means. I have no clue how to switch between JSON and binary. This will be my third game developed with Unity and I've never run into or heard anything about that stuff.

    I just have a behavior tree in my scene that I use to control my enemy. The enemy gameobject is a prefab but I keep it broken because if it is not broken, I can't edit tasks in the tree. I've never really understood why that is the case. After I work on the tree for a while, I'll apply the prefab, save the scene and then break the prefab again so I can continue to edit the tree. Granted I may work on that thing for a few weeks before I remember to apply the prefab.

    Is it possible this has something to do with the length of time I go before I apply the prefab with changes I've made. (Is that what dirty means?)

    Allan
     
  12. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Within the Behavior Designer preferences (on the top right of the editor) change the serialization type to JSON. You should then be good to go! This does relate to applying the prefab with a large tree.
     
  13. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Awesome!! Thanks I'll check it out. I'm really loving Behavior Designer.
    It has enabled me to do stuff with Enemy and Pet AI that would be impossible with my own coding.

    I also just noticed in the Preferences Panel the ability to edit Prefab Instances so that answers that question as well.
    (Mental Note: Check the preferences panel before posting stupid items on the forums) :)

    My 2 biggest improvement requests are:
    - being able to identify/highlight all tasks that use specific variables through a search or some other mechanism
    - ability to expand and shrink the Properties Panel

    Allan
     
  14. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Opsive,

    Do you have a recommendation for how I could implement a cool-down concept using tasks.
    Let me explain:
    I have a sequence that controls my EnemyAI to do an attack. The sequence beings with a Bool Comparison that checks to see if the Player has lost balance. The Bool is a shared variable on the enemy that is linked to a parameter on the enemy that is updated by an Event passed to my EnemyController from the Player. So that bool is set to true whenever the player loses balance and then set back to false when the player gets back up again. If the player loses balance then the Enemy goes in to make a Finishing attack move on the player. It works great except the enemy will repeat the attack if the player was not able to regain balance and this may be repeated until the player is dead. I would like to have a sort of cool-down so that sequence, after it has fired, will not be not reevaluated again until after a certain amount of time.

    Right now I have the sequence set to Both so it is constantly reevaluating. Here is a pic of that branch of my tree. My entire tree is structured exactly like your soldier trees from the Third Person Shooter AI sample.

    Capture.PNG

    Thanks
    Allan
     
    Last edited: Nov 10, 2016
  15. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    You could add one more conditional task that acts as a cooldown, similar to your two comparison tasks. This would then allow the agent to only attack after the specified cooldown has elapsed.
     
  16. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    BehaviorDesigner soft locks unity when trying to delete a custom made shared variable out of the tree. Changing the variable to another type does not fix the problem. I can't delete any variables out of the tree. This is a 100% repro.

    What could cause this? What should I do to fix the issue?
     
  17. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
  18. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    Update. I have a multi monitor setup. The "Do you want to delete the variable" dialogue was appearing off screen and behind another app. Suggest this dialogue appear at the behavior designer window.

    Crisis averted.
     
  19. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    That was easy :) That dialog is shown using EditorUtility.DisplayDialog which doesn't allow you to specify a window so unfortunately there's not anything that I can change.
     
  20. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    Ah no worries.

    Few other questions if you don't mind.

    1) I changed the type in a SharedVariable and I can't get behavior designer to update for the life of me. I've even tried restarting unity. It just continues to act like the old class is plugged in until I try to assign something, then it reverts to the new class until its added again. Very odd. Is there a behavior designer cache that can be cleared?

    2) I wanted to have a dictionary and custom item class as a variable.
    will this work if the item itself does not serialize?
    Code (csharp):
    1.  
    2. [System.Serializable]
    3.  
    4. public class SharableItem
    5.  
    6. {
    7.  
    8. public Item m_Item;
    9.  
    10. }
    11.  
    12.  
    Also
    should this be working?
    Code (csharp):
    1.  
    2. [System.Serializable]
    3.  
    4. publicclassSharedDictionaryTarget : SharedVariable<Dictionary<RelationshipType, Dictionary<InstanceID, AITargetRecord>>>
    5.  
    6. {
    7.  
    8. public static implicit operator SharedDictionaryTarget(Dictionary<RelationshipType, Dictionary<InstanceID, AITargetRecord>> value) { returnnewSharedDictionaryTarget { mValue = value }; }
    9.  
    10. }
    11.  
    12.  

    If not its not a problem. I'll just reference those variables on an external component.

    In both cases I can't link them to a Task.

    Thanks!
     
  21. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Do you mean within the variable window you change the type? Or somewhere else?

    Unity does not serialize dictionaries so you can use that SharedVariable at runtime but it won't serialize.
     
  22. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    So here is the "just added Item" it still has a field for "Item".
    upload_2016-11-11_19-52-50.png
    If I click the little 0 to try and assign the item it updates:
    upload_2016-11-11_19-53-45.png
    The above is the updated "SharedItem" class. Everytime I re-add the variable It starts out as the old class.
     
  23. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    Also good to know shared variables with non-serialized fields can be used at runtime. I don't need to serialize anything in the AI. :)
     
  24. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Is Item the Third Person Controller Item class? Or your own? Is it abstract?
     
  25. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    Its my own. Its not abstract but does Inherit from other classes. Its not blocking me at this point though so not a huge concern. I'll let you know if I figure out what it is, until then no worries.

    Few more questions for you.
    I'm looking at the RTS example and noticed that you only use Behavior Tree References at the end of a chain. My understanding though is its just "Pasting" the tree in. So I think it can be used anywhere in the chain.

    My goal is to have a sub behavior tree that the rest of the behavior tree waits for.
    E.g. Start -> Sub Behavior Tree Wait for Scenario Event -> Do more stuff. Sounds like your intention correct?

    Also with "Start Behavior Tree"
    I think the intention here that I'd be starting an external behavior tree on another object correct?

    Lastly are there any way to "filter" referenced trees during debug? So I can only see the referenced tree or main tree, etc... The window turns into a bit of a mess with lots of referenced trees.

    Also just got this error and the behavior tree no longer loads: I hit a magnifying glass on the ReceiveEventNode.
    NullReferenceException: Object reference not set to an instance of an object
    BehaviorDesigner.Editor.NodeDesigner.DrawNodeComment (Vector2 offset)
    BehaviorDesigner.Editor.GraphDesigner.DrawNodeCommentChildren (BehaviorDesigner.Editor.NodeDesigner nodeDesigner, Vector2 offset)
    BehaviorDesigner.Editor.GraphDesigner.DrawNodes (Vector2 mousePosition, Vector2 offset)
    BehaviorDesigner.Editor.BehaviorDesignerWindow.DrawGraphArea ()
    BehaviorDesigner.Editor.BehaviorDesignerWindow.Draw ()
    BehaviorDesigner.Editor.BehaviorDesignerWindow.OnGUI ()
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

    Really love this asset thanks so much for creating it! Thanks for the help.
     
    Last edited: Nov 12, 2016
  26. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    280
    @opsive Are the source code packages up2date? I'm just asking because the imported gizmos differ with the asset store version. Also the documentation pdf seems to be missing in that package.

    p.s. Have you seen any benefit in separating the asset to a runtime and source code bundle?
     
  27. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    @hoesterey -

    Yes, that's correct. External trees combined with the Behavior Tree Reference task are a great way to reuse common branches

    No - Start Behavior Tree will start a tree within the Behavior Tree component, not an External tree.

    Yes, if you hover over the reference task you can collapse the task which when the tree is loaded it will then start the external tree collapsed so you don't see it.

    I have this one fixed - send me a PM with your invoice number and I'll send you the latest :)
     
  28. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Yes, the source package points to the latest version. It looks like the gizmos icons are the same but the import type is different - if you change the texture type to Editor GUI you'll be good to go. I didn't include the documentation in this package figuring you already have it with the Asset Store version and the pdf takes up the majority of the size for the Asset Store version.

    There is a small amount of benefit if you use the source version - the DLLs include some editor hooks and when you build the source version to a game those hooks are not populated. This is extremely, extremely minor though so personally I always use the dlls to reduce the overall compile times.
     
  29. Ashamen

    Ashamen

    Joined:
    Oct 8, 2013
    Posts:
    20
    I am curious if anyone has tried to use this with Forge Networking? More specifically with their new Remastered networking?

    How easy/difficult would it be to get Behavior Designer to work with a different networking solution than Unity 5's built in solution?
     
  30. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    664
    Just updated to the latest version. When I have a Behavior Asset selected in the Inspector and go in Play mode I receive these two errors. No big deal of course. Running Unity 5.4.3f1

     
  31. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    What version did you update from? It looks like your tree is using a pre-1.5.6 serialization method- if you move some tasks around in the current version it will serialize with the latest version.
     
    McDev02 likes this.
  32. Amitloaf

    Amitloaf

    Joined:
    Jan 30, 2012
    Posts:
    97
    I have two issues:
    1. I want to get some information on how to create a task which always runs (to register inputs) even if another task returns TaskStatus.Running.
    2. I wanted to check the forums but it says my invoice number is bad and you haven't responded to my email in two weeks now. Can you please help?
     
  33. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Do you mean by having multiple tasks active using the parallel task? Or by using a decorator to modify the return status of a child task?

    Sorry about that, I don't remember seeing your email. Can you either send it again to support@opsive.com or send me a PM?

    Edit: I just saw your email - it was in my spam folder. The number that you sent doesn't look like a valid invoice number, you can get all of your invoices on this page. Feel free to get in contact with me if it still doesn't work.
     
    Last edited: Dec 5, 2016
  34. Amitloaf

    Amitloaf

    Joined:
    Jan 30, 2012
    Posts:
    97
    Thanks, I have 3 main tasks - one is for resetting variables, then it's the actual decision tree and the last one cleans up and registers input. I want to run the variable reset and the input register regardless if it's currently in a task that returns Running (it seems to block the other ones until I release it)
     
  35. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Instead of parenting those three tasks to a Sequence task you should detach the input task and parent it with a Parallel task, similar to:

    BehaviorScreenshot.png

    This will allow Register Input to run at the same time as the left branch.

    For more of an overview in how behavior trees work take a look at this page: http://www.opsive.com/assets/DeathmatchAIKit/documentation.php?id=3. It explains a pretty large behavior tree as well as has links to other resources.
     
    99thmonkey likes this.
  36. Nition

    Nition

    Joined:
    Jul 4, 2012
    Posts:
    781
    Hi, I'm wondering if I could get a little bit of advice on my setup, I'm still getting the hang of the basic systems in Behaviour Designer.

    I have a setup like this at the moment:



    What I'd like to happen is, if the citizen can see a cop, they set a location to flee to (BD Get Flee Location, bottom left), go there (BD Go To Location), and then once they're there, re-evaluate. If they can still see a cop, get a new flee location and move there. If they can't see a cop, drop into the "Random roam around" branch.

    The problem with my current setup is, once the cop branch drops past the Repeater, it gets stuck there, repeating forever. But if there's no repeater, they'll only flee from the cop once, then just wait there.

    This is a fairly simple situation - is there a general "ideal" way to set up a behaviour tree for this sort of thing?
     
  37. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    The Selector Evaluator has a pretty specific use case so I wouldn't use that task for this situation. Instead you should use a Selector with conditional aborts. This post has a simple example of what I'm referring to. You don't want to have the repeater in that left branch - you may be able to get what you're going for with a Both conditional abort.
     
  38. Nition

    Nition

    Joined:
    Jul 4, 2012
    Posts:
    781
    Thanks man. Got it working, or at least close enough that it looks like it's working, with this setup:



    Although I've added an extra feature to it since the last image as well. One extra thing it seemed to need that I hadn't done was enabling "Restart When Complete".
     
    opsive likes this.
  39. mrm83

    mrm83

    Joined:
    Nov 29, 2014
    Posts:
    345
    Hi
    How well does this perform on mobile and what are the limitations at?
    Say the device is iphone 5 (or some 3 year old device)

    Can it have 100 agents with a fairly complex tree?
    What about 500?

    I want to dive into this, but am worried about performance on mobile devices when there are too many agents.
     
  40. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Traversing the tree is extremely quick and you're likely to hit other sort of bottlenecks (such as graphics or animation) before you hit a tree traversal bottleneck. I can't really give an exact number of the agents that you'll be able to have because there are so many factors and dependent on your game type. In general though you don't have to worry about traversing the tree being your limiting factor.
     
    mrm83 likes this.
  41. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    Heya,
    Just ran into a major issue after updating to Unity 5.5p1. Already tried updating to the latest behavior designer but am having no luck.

    I'm getting this error when clicking in the editor and no tasks will load:

    ReflectionTypeLoadException: The classes in the module cannot be loaded.
    System.Reflection.Assembly.GetTypes () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/Assembly.cs:371)
    BehaviorDesigner.Editor.TaskList.Init ()
    BehaviorDesigner.Editor.BehaviorDesignerWindow.Init ()
    BehaviorDesigner.Editor.BehaviorDesignerWindow.OnFocus ()
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:249)
    UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:242)
    UnityEditor.HostView.OnFocus () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:90)
     
  42. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Does it occur with a fresh project? Can you narrow down which assembly in your project it is trying to load?

    Edit: It looks like you get that error when an assembly was built for the wrong version of .Net: https://forum.unity3d.com/threads/i...lasses-in-the-module-cannot-be-loaded.230389/
     
  43. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    I've tried all the steps in that thread but no go. Also tried importing the designer into a new project and have the same issue. I'm posting a bug to unity as well.

    here is the editor log.
    Refresh: detecting if any assets need to be imported or removed ... Refresh: elapses 0.003600 seconds (Nothing changed)
    ReflectionTypeLoadException: The classes in the module cannot be loaded.
    at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
    at System.Reflection.Assembly.GetTypes () [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/Assembly.cs:371
    at BehaviorDesigner.Editor.TaskList.Init () [0x00000] in <filename unknown>:0
    at BehaviorDesigner.Editor.BehaviorDesignerWindow.Init () [0x00000] in <filename unknown>:0
    at BehaviorDesigner.Editor.BehaviorDesignerWindow.OnFocus () [0x00000] in <filename unknown>:0
    at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
    at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d0] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000eb] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232
    at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115
    at UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) [0x00013] in C:\buildslave\unity\build\Editor\Mono\HostView.cs:249
    at UnityEditor.HostView.Invoke (System.String methodName) [0x00009] in C:\buildslave\unity\build\Editor\Mono\HostView.cs:242
    at UnityEditor.HostView.OnFocus () [0x00007] in C:\buildslave\unity\build\Editor\Mono\HostView.cs:90
    (Filename: /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/Assembly.cs Line: 371)
     
  44. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    I just tried a fresh 5.0p1 project with Behavior Designer 1.5.8 and didn't get any errors. I would double check the assemblies that you have imported - I haven't gotten any other reports of this error and based on the p1 release notes it doesn't look like anything would have changed with regards to this.
     
  45. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    I've figured it out. Turns out they updated the GUI extension in 5_5 but didn't put that in the manuals upgrade notes.
     
    opsive likes this.
  46. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
  47. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    659
    Quick feature request.
    I preload about 1000 entities at level start. As a result the list of behavior trees gets unmanageable. Any way an option could be added to only show enabled gameobjects in that list?
    upload_2016-12-13_19-13-27.png
     
  48. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Noted :) It will have to be a preference but that really would clean things up if you had a bunch of GameObjects - thanks for the suggestion!
     
  49. mroveli

    mroveli

    Joined:
    Jun 9, 2013
    Posts:
    1
    Hello!

    I am planning to change my AI solution for various reasons and researching various other packages. BD is on the top of my list but one thing really bothers me.

    Since BD doesn't incorporate out of box FSM solution how easy is it to keep track of object states?

    Case on point would be following - Huge level with dozens of interactive doors. Guard is patrolling hallways and is supposed to spot open door. What I am getting from the documentation is that sharedvariable would be way to go but creating dozens of them and manually mapping them to individual scripts sounds kind of pain in a$$.

    I guess, what I am asking is - Is there anyway to get custom component (MonoBehaviour) of the active GameObject (Go in the radious, Raycast hit result or whatever) and read property of this custom component.

    Something like this : Guard sees the door, then Get Door (GameObject) ---> Get DoorScript (MonoBehaviour) ---> Check if IsOpen(bool) is true.

    Sorry, if I am asking too much :)
     
  50. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Thanks for taking a look Behavior Designer!

    Yes, there is. In that case you'd do a standard raycast or use the Can See Object task to determine that a door is in sight, and from there you can use GetComponent to get the actual DoorScript. Behavior Designer tasks are similar to MonoBehaviours so anything that you can do within a MonoBehaviour component you can pretty much do within a task.