3 different values from 1 input? Bug

Why there are 3 different values from the "Damage" source? Whats going on?

6860693--800081--bolt.png

here is how it looks outside:
6860747--800096--upload_2021-2-21_11-14-56.png

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.

1 Like

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.