Reply To: Tick() broken for non-repeat graph without actions running over time

NodeCanvas Forums Support Tick() broken for non-repeat graph without actions running over time Reply To: Tick() broken for non-repeat graph without actions running over time

#14083
clem
Participant

Hello again!

I updated to the latest version of NodeCanvas and the problem is back so I have to repeat my local hacky fix again, and figured I’d point out the issue once more in hope for an official fix.

Here’s how I’m using Node Canvas:

  • I control my player character with a Behavior Tree so I can visually organize what to do based on conditions (e.g. is the player trying to move, is the movement allowed, etc.) not necessarily because this makes more sense than hard-coding player logic but because that way all actors in the game, whether AI or players, follow the same structure and I can share modules between them.
  • At the moment, that BT controlling my player does not actually run any actions for longer than a frame. For instance, it determines what forces to apply or what direction to move to, but does not enter an action that completes later, and so the BT ends the frame it is called.
  • My actor setup is fairly advanced, so I want the BT to be called after a lot of other scripts have ran (e.g. sensing the surroundings into data that can be used for determining what to do this frame) and before others do (e.g. kinematic physics calculations) so I want to call it manually at a specific point each frame with Tick() (not to set it to repeat automatically)

This used to work just fine when I initially created this setup, but after upgrading NodeCanvas a few months ago, it is no longer executing my BT each time I Tick() it, only once the first time.

In CanvasCore/Framework/Runtime/Graph/Graph.cs, I have to remove the check for isRunning == true in the UpdateGraph function to make my BT work, as a graph that doesn’t start any longer-than-one-frame action will apparently only “run” for one frame, and so Tick() will not execute it past the 1st frame (where it actually starts and gets executed once).

You suggestion from a few months ago does not help, the graph still isn’t considered to be running after the initial frame it ran and completed on, so Tick() does nothing.

Repro steps:
– Create a new project
– Import NodeCanvas
– Create a new GameObject
– Add a Behaviour Tree Owner to that object & set it to not repeat and do nothing on Enable/Disable
– Create a bound BT for that owner that simply logs a variable value from the blackboard
– Create a MonoBehaviour on that same object that contains the following code:

What happens:
– The value of the blackboard variable is logged once

What I expect:
– The value of the blackboard variable is logged each frame

This would work:

but means it won’t work for any graph that lasts more than one frame.

Could you look into this issue please, and either support that functionality again, or let me know of an alternative supported way to achieve that result?

I guess the old Tick() behavior was “start or update” and the new one is “update if running” which is causing my issues. I’d just like to be able to update NodeCanvas without having to reapply fixes each time to maintain the functionality of the NodeCanvas version I started my project with.

Thank you

EDIT:
I guess I was a bit caught up on making sure Tick() worked like it did before, I can do this I guess:

Let me know if you see any issues with that approach, thank you

Attachments:
  1. 01.jpg