Best practice using Reflection-based tasks?

Foehammer

New member
I've managed to get a behavior tree to do what I want, without having to write a single custom action or conditional task, or custom shared variable. This is in large part due to synchronizing variables and using reflection tasks like invoke method. Is this approach inadvisable from a performance perspective? In particular I'm curious if the slowness associated with reflection in general, would hit performance only once, when these tasks are first run, or every time the behavior tree runs?
 

Justin

Administrator
Staff member
The reflection tasks are great for getting something up and running without running any code. However, as you mentioned, there is a cost associated with it.

Is this approach inadvisable from a performance perspective? In particular I'm curious if the slowness associated with reflection in general, would hit performance only once, when these tasks are first run, or every time the behavior tree runs?
From a performance perspective it is not advisable to use the reflection tasks. Every time the task is updated there is a performance hit that you would not have if you called the function directly. Some reflection tasks are worse than others, but it's not going to be as quick as a direct call. As with anything though I would profile it to see if the behavior tree is causing a bottleneck. If it's not causing a bottleneck then there's no reason to switch.
 
Top