A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Visual Scripting' started by Ts1nd, Feb 21, 2021.
Why there are 3 different values from the "Damage" source? Whats going on?
here is how it looks outside:
everything is on the "Enter State" coroutine so no update etc. Should be calculated once
Bolt caches connection values and only refreshes them when the logic is triggered again. If part of your logic was not triggered, then it'd display the old value while the other parts that were triggered and executed would show the new values.
Alternatively, Bolt can also retroactively execute logic when a value is requested. So Bolt might be executing your previous superunit multiple times to get the Damage value. You should either cache that value inside a variable or use "cache" node between superunits.
Apparently the reason was some very unintuitive way Bolt handles random values - when you get random value and access it from multiple sources, it will recalculates it each time instead of using the already calculated one. I am wondering if the same will happen with superunit functions, will it calculate superunit output each time its accessed even if its deterministic and the same all the time?
I fixed it by setting object variable "Roll" for each character and thats ridiculous. Should be calculated in code...
In C# you typically still cache the results of a function in a variable (even if a local variable). Bolt allows you to pass values without defining local variables, but it doesn't automatically cache them for you. In that way it's more flexible than C# but I agree - it can be unintuitive.