Recent content by Noxalus

  1. N

    Performance improvement by batching agent behavior tree update

    Thank you very much for your answer, and sorry for not reading the documentation properly. So from what I see, the code above should looks like that: public class AIManager : MonoBehaviour { // List of all agents present in the game currently private List<Agent> _agents = new...
  2. N

    Performance improvement by batching agent behavior tree update

    Hello everyone, We are working on a tycoon game with ~200 active agents at the same time, and we would like to reduce the cost of AI logic by splitting their execution over multiple frames. Here is the code I would like to write: public class AIManager : MonoBehaviour { // List of all...
  3. N

    InvalidCastException: Specified cast is not valid in Behavior.SetVariableValue method

    After further tests, it seems that the "value" must implement IConvertible interface and the update trigger an "InvalidCastException" for some type (or when "value" is null), I updated the code like that: if (value is IConvertible) { mValue = (T)Convert.ChangeType(value, typeof(T)); } else...
  4. N

    InvalidCastException: Specified cast is not valid in Behavior.SetVariableValue method

    It occurs when I try to set an object containing an integer in a shared variable that expects a float. I fixed it updating the class SharedVariables.cs (line 151) from this: mValue = (T)value; To this: mValue = (T)Convert.ChangeType(value, typeof(T));
  5. N

    Execute logic before and after a BehaviorTreeReference task

    Thank you again for your help @Justin ! I finally resolve my issue doing like that: _behaviorTree.DisableBehavior(false); _behaviorTree.ExternalBehavior = null; _behaviorTree.ExternalBehavior = MyBehavior; _behaviorTree.EnableBehavior(); _behaviorTree.DisableBehavior(false); var...
  6. N

    SharedString provided to a BehaviorTreeReference are not properly retrieved in a List<SharedString>

    Thank you again Justin, I looked at the code but after some more tests, it appears that if we have the same variable name in the tree loaded by the BehaviorTreeReference, the value is properly set and can be used in a List<SharedString>. I prefer to let the code untouched and use this solution...
  7. N

    SharedString provided to a BehaviorTreeReference are not properly retrieved in a List<SharedString>

    Thank you for the quick answer! If I do that, I won't be able to have constant values defined directly on the action like the "42" in my example, and I need that because I could have the same action multiple time in the same external behavior tree. :cry: If I would like to look through all of...
  8. N

    SharedString provided to a BehaviorTreeReference are not properly retrieved in a List<SharedString>

    Hello, I think I found a pretty weird bug. My goal is to transmit a variable value to a BehaviorTreeReference from its parent. The BTR loads a simple tree with only one action: The code for this action is here: using UnityEngine; using BehaviorDesigner.Runtime; using...
  9. N

    Execute logic before and after a BehaviorTreeReference task

    Thanks a lot for your answer @Justin ! The first solution sounds great, but I'm not really sure to know how to achieve this ? What I did is to create a method SwapBehaviorTreeReference() in my InternalState class (which inherits from BehaviorReference) with this content: public void...
  10. N

    Execute logic before and after a BehaviorTreeReference task

    Hello everyone, Since several days, I try to find the best approach to do that and I don't succeed to find a proper solution that works as I would like. The idea is that I want to create a new task that act like the BehaviorTreeReference but is able to perform logic before and after its...
  11. N

    Override click action on a Task in the Editor

    Hello everyone, When I use the action "Behavior Tree Reference" in a behavior tree and that I link an external behavior tree in this action, I can jump directly to this external behavior tree by double clicking on the action. I would like to do something similar but for an action I created...
  12. N

    Recommended way to code up async tasks

    I've started to do that, but the best way to do what I want is using a return value for Coroutine (like explained here).
  13. N

    Recommended way to code up async tasks

    What if the coroutine fails and you want to return a TaskStatus.Failure?
Top