BehaviourTreeOwner StartBehaviour cause frame rate drop

Forums 💬 NodeCanvas ⚙️ Support BehaviourTreeOwner StartBehaviour cause frame rate drop

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #17727
    onesoftgames
    Participant

      Hi,
      I am using BT for the enemy and when an enemy spawns from the pool system, I manually call treeOwner.StartBehaviour() (Do not start when enabled )
      I using BT as assets (not bound to object because enemy prefab will be controlled by pool system)
      After Profiling I see graph.StartGraph takes more than 100 ms in my Android device.(a medium speed Oppo branch device)
      So is there any way to get smooth fps at run time? Maybe we can call some function at the start to preload or do the heavy work first?

      Thank so much!

      #17730
      Gavalakis
      Keymaster

        Hello,

        Sorry for the late reply!
        Right now, graphs are initialized as soon as the first execution call to them has been made, thus the first time the Behaviour is enabled/started.
        I will introduce a way to pre-initialize behaviours in a future update soon, but until that is implemented, what you can do is to let the behaviours automatically start when enabled for one frame and manually stop them immediately by calling StopBehaviour(), only to call StartBehaviour() once again when you need the behaviour to start.
        This way, the behaviour will get a chance to initialize.

        Please let me know if that works for you, but once again, the ability to pre-initialize behaviours will be possible in a very soon to come update.
        Thank you!

        #17729
        onesoftgames
        Participant

          Hi!
          Thank for your answer!
          I push the initialize to the very first of game start and I think it is ok!
          I will wait for the next version, thanks so much!

          #17728
          Gavalakis
          Keymaster

            You are very welcome! 🙂

          Viewing 4 posts - 1 through 4 (of 4 total)
          • You must be logged in to reply to this topic.