Some Behavior Designer Pro feedback

ghos7report

New member
1. The Wander action, part of the movement pack, seems to never stop to wait at the destination, even though I've set it to wait for a few seconds. It just goes to the next one immediately. I'll attach an image of my Wander setup.
2. I'm trying to use the Unity method FindGameObjectWithTag as an action. It lets me add it to the tree but it doesn't let me bind the result to a variable (even though the variable appears in the dropdown). Also when I start the game, I get the error:
Error: Unable to find the method FindGameObjectWithTag.

Thank you!
 

Attachments

  • wander_setup.png
    wander_setup.png
    38.2 KB · Views: 7
Thanks for letting me know!

1. The Wander action, part of the movement pack, seems to never stop to wait at the destination, even though I've set it to wait for a few seconds. It just goes to the next one immediately. I'll attach an image of my Wander setup.
I have this fixed, but noticed that some test code snuck into the Seek task so I am going to do a quick Movement Pack update. It'll be available on the Asset Store shortly.
 
2. I'm trying to use the Unity method FindGameObjectWithTag as an action. It lets me add it to the tree but it doesn't let me bind the result to a variable (even though the variable appears in the dropdown). Also when I start the game, I get the error:
Error: Unable to find the method FindGameObjectWithTag.
There were two issues:
- The task delegate task couldn't find the static method
- The UI dropdown wasn't picking up the correct changed value.

I'll send you a PM with the fixed files.
 
Thanks a lot Justin, I've tested these and both my problems were fixed.

Another thing I was thinking about, Unity Behavior has a predefined action FindClosestGameObjectWithTag.
Do you think it could be useful to add this in BD? If yes, it's not really a priority for me as I can write it myself, just throwing it out there :)

Thanks again for the swift response and fixes!
 
Glad it worked!

The next add-on that we release is called the Senses Pack and with that it will include distance checks (among a wide variety of other sensors). You can find objects by a tag so a variant of FindClosestGameObjectWithTag will appear there :)

Are there any other tasks from Behavior that you were using?
 
I can't think of anything else that doesn't have an equivalent in BD. Although something that I really like there, which is not in BD, is the repeat option in the Start node (and the fact that it is enabled by default). I feel like such a thing would be really helpful in BD as well, as most behaviors in a real game would be repeatable. Hooking up the Start to a Repeater is not as intuitive, especially to a new user imo.
 
Hey Justin, I've tried the Save/Load system by using the Save and Load methods of the tree (SaveData). I have two issues:
1. Graph variable of type GameObject is not loaded properly, after a Load it is left empty. I've set it in the scene, it's basically a reference to the player.
2. GameObject boolean variable that I share between two trees is also not loaded properly. I save it as true and it's loaded as false (the default value probably).

Thank you!
 
1. Graph variable of type GameObject is not loaded properly, after a Load it is left empty. I've set it in the scene, it's basically a reference to the player.
That's expected - scene GameObjects cannot be serialized as project-level assets cannot reference scene objects. For this you'll need some other workaround. In the Save/Load demo scene I fetch the objects again after the behavior tree is loaded.

2. GameObject boolean variable that I share between two trees is also not loaded properly. I save it as true and it's loaded as false (the default value probably).
Did you save the GameObject variables? It's an optional parameter on the Save and Load methods: https://opsive.com/support/documentation/behavior-designer-pro/save-load/
 
Thanks, dumb question, where can I find these demo scenes? I looked at all of the imported files but couldn't find any scenes.
Maybe this will ask the rest of the questions I have so I'll try looking through them first.
 
You can import them through Tools -> Opsive -> Behavior Designer -> Samples. I'll add a note about this in the documentation.
 
Hopefully, I'm not writing too much :D
After testing for a bit I have two more things to share:

1. The Graph variable of type GameObject that I previously mentioned starts out as none and later gets populated with a GameObject from the scene. That's all good, but if I save the game before it gets populated (while it's null) and load, I get an error:
Code:
NullReferenceException: Object reference not set to an instance of an object
Opsive.BehaviorDesigner.Runtime.Utility.SaveManager.Load (Opsive.GraphDesigner.Runtime.Variables.ISharedVariableContainer variableContainer, Opsive.BehaviorDesigner.Runtime.Utility.SaveManager+VariableSaveData saveData) (at ./Packages/com.opsive.behaviordesigner/Runtime/Utility/SaveManager.cs:637)
If I add a null check in the following way, it seems to be working for me but you can decide how to handle it of course:
Code:
if (saveData.Values[i] != null)
{
    var sharedVariableValue = saveData.Values[i].DeserializeFields(MemberVisibility.Public);
    sharedVariables[i].SetValue(sharedVariableValue);
}

2. This one is a bit more tricky. I have a conditional Wander behavior in my tree. If I save the game while the agent is not Wandering, then wait for the condition to Wander to become true, then load the game, the agent starts to move to the Wander position it was heading for before I loaded the game. Thus, my save is not really a snapshot because it gets overridden by things that happened after it.
 
1. The Graph variable of type GameObject that I previously mentioned starts out as none and later gets populated with a GameObject from the scene. That's all good, but if I save the game before it gets populated (while it's null) and load, I get an error:
Thanks, I'll add something similar.

2. This one is a bit more tricky. I have a conditional Wander behavior in my tree. If I save the game while the agent is not Wandering, then wait for the condition to Wander to become true, then load the game, the agent starts to move to the Wander position it was heading for before I loaded the game. Thus, my save is not really a snapshot because it gets overridden by things that happened after it.
You're right, this one is more tricky. I am going to need to think about the right way to handle this. Right now when the behavior tree is loaded it isn't first stopped and I probably need to do that. From there the movement tasks will need to set their original destination again when it is started.

I'll have this one fixed in the next update which will probably be early next week.
 
That looks like it's serializing the tree. I could add an option to only serialize the tree when you press control-S.
 
Hey Justin, after updating to Movement Pack Version 2.0.1, after I Load the behavior tree, I get the following exception:
Code:
MissingMethodException: Default constructor not found for type System.Object[]
System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic, System.Boolean wrapExceptions) (at <191a1970a53948f9819ac1d2e4f5c72e>:0)
System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean wrapExceptions, System.Boolean skipCheckThis, System.Boolean fillCache) (at <191a1970a53948f9819ac1d2e4f5c72e>:0)
System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Boolean wrapExceptions, System.Threading.StackCrawlMark& stackMark) (at <191a1970a53948f9819ac1d2e4f5c72e>:0)
System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic, System.Boolean wrapExceptions) (at <191a1970a53948f9819ac1d2e4f5c72e>:0)
System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) (at <191a1970a53948f9819ac1d2e4f5c72e>:0)
Opsive.Shared.Utility.Serialization.DeserializeFields (Opsive.Shared.Utility.MemberVisibility visibility, System.Func`3[T1,T2,TResult] onValidateTypeCallback, System.Func`4[T1,T2,T3,TResult] onValidateCallback) (at <dbf517ed1cca431ca822b65e003afac0>:0)
Opsive.BehaviorDesigner.Runtime.Utility.SaveManager.Load (Opsive.BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Opsive.BehaviorDesigner.Runtime.Utility.SaveManager+BehaviorTreeSaveData saveData, System.Action`1[T] afterVariablesRestored, System.Collections.Generic.Dictionary`2[TKey,TValue] variableByNameMap) (at ./Packages/com.opsive.behaviordesigner/Runtime/Utility/SaveManager.cs:584)
Opsive.BehaviorDesigner.Runtime.Utility.SaveManager.Load (Opsive.BehaviorDesigner.Runtime.BehaviorTree[] behaviorTrees, Opsive.BehaviorDesigner.Runtime.Utility.SaveManager+SaveData saveData, System.Action`1[T] afterVariablesRestored) (at ./Packages/com.opsive.behaviordesigner/Runtime/Utility/SaveManager.cs:467)
Opsive.BehaviorDesigner.Runtime.BehaviorTree.Load (Opsive.BehaviorDesigner.Runtime.Utility.SaveManager+SaveData saveData, System.Action`1[T] afterVariablesRestored) (at ./Packages/com.opsive.behaviordesigner/Runtime/BehaviorTree.cs:1226)
I updated Behavior Designer before that and tested it out, so I can confirm that it's the Movement pack update that's causing it.

Edit: I saw that the Wander task has a different Save and Load method than the others so I tried removing it from the Behavior tree. This has fixed the problem, so it's most likely a problem with that task specifically. Hopefully this saves you some time.

Can you please check?
 
Last edited:
This looks like it's a serialization issue, I'll take a look at a fix for the next update. Thanks for the heads up!
 
I don't have an issue to report as I haven't yet really gotten into BDpro,I have opened it up and I noticed on the videos you can have the BD editor window open and still, for instance press play and pause in he editor as well as drag references and such into the editor with out the DB pro editor going behind Unity Editor, is there a way to enable this in DB pro? I don't believe there is a way to do it in Unity Editor in its settings, I could be Wrong? would adding something like EditorWindow.ShowUtility(); in DBpro allow for this? if so a Toggle at the top of the DBpro Editor would be a fantastic quality of life improvement... if this can work which script would be the appropriate on to edit? If I dock BDpro there seems to be more visual errors with the editor then when its floating, but when its floating I can't drag references or start and stop unity with out it vanishing behind unity editor and that's a pain...
 
If you have the editor open you can drag into the window - just make sure no other floating windows are also over the drag area as those will then become the focus.
 
嘿贾斯汀,当使用 Behavior Designer Pro 时,当我删除或禁用游戏对象时会发生错误。
 

Attachments

  • A9EE6348-3A82-4b95-B48B-E2CB43793C82.png
    A9EE6348-3A82-4b95-B48B-E2CB43793C82.png
    230 KB · Views: 11
Back
Top