we ran into a super curious behavior in a blueprint, that goes against how I thought blueprints execute code: A Print String node changes the way previous nodes are executed. It’s a bit iffy to debug, since printing the value causes the issue.
Pressing the buttons 1, 2 and 3 should set the z-scale of a cube to 1/1, 1/2, and 1/4 respectively. Since the divide node uses two integers as inputs, and outputs a float, the result is truncated to 1/1=1.0, 1/2=0.0, and 1/4=0.0. So far so good.
But as soon as we plug in the Print String node (or any node that uses the result of the divide node), the divide node casts the integers to floats before the division, and the results are 1/1=1.0, 1/2=0.5, and 1/4=0.25. It doesn’t even matter where the Print node is plugged in; it doesn’t even need to be called. As long as it’s compiled, it changes the way the division node works.
The same thing happens when we use a Set Variable node for example:
There’s a handful of bugs in the DB regarding type promotion, some backlogged with target fixes in v5.5… But I could not find anything related to this very issue specifically.