A few initial questions

FlowCanvas Forums Support A few initial questions

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #750

    I’m just getting started with NodeCanvas and FlowCanvas and I had a few questions.

    1. I think I understand this one, but want to make sure. Is the purpose of Cache<T> to cache something like components? For example Cache<Transform>, or Cache<MyComponent>. If so, do you just use the same node Cache<Whatever> every time you want to call that component and it uses the cached value?

    2. Reflection is known to be very slow, especially on mobile. I seem to be using it a lot with FlowCanvas. I have looked through the code some, but can’t figure out if there is any sort of caching going on to help with this?

    3. It looks like using Blackboards can use a lot of strings to get/set values from blackboards between objects. I believe using string in this way can cause a lot of garbage collection. Would it be better, performance wise, to use a script componenet that contains the properties you want available to other objects and pass that component to the other objects and use the Functions/Reflected to get/set on those objects? Hope that makes sense.



    Hello Tim and welcome 🙂

    Let me address your questions:

    1) Yes, the purpose of Cache node is to cache some data. The cache takes place when the Flow Input is called. Then whenever you want to use the cached data, you simply use the “Value” output of the same node.

    2) FlowCanvas creates delegates out of reflection and as such there is no reflection calls in actual runtime after initialization, but rather only a simple delegate call which is very close if not the same to the speed of calling a method directly. If you want to see what it’s done behind the scenes, please take a look at ReflectedMethodNode.cs file. This applies to all non AOT platforms.

    3) Once again here, Blackboard Variables are bound (delegates created) so in practice the string name of the variables no longer matter in runtime after initialization. You can check out what happens in BBParameter.cs at line #305 if you want so 🙂

    Similar optimizations can be found throughout the whole tool as well 🙂


    Join us on Discord: https://discord.gg/97q2Rjh


    Sorry for the late response, but thank you for answering all of my questions! That all makes sense.

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