Formatting strings with floats

Hey there, I’ve been trying to use the string formatting in Burst to output some text to the debug console with floating point data. It looks as if Burst can’t output fractional values when using the G format option, it only outputs the integer portion.

var intValue = 1;
var floatValue = 1.45745f;
FixedString128Bytes text = $"Test {intValue} {floatValue:G5}";
Debug.Log(text);

I would expect the above to output “Test 1 1.4574”, but it only outputs “Test 1 1”. Reading the docs here seems to suggest that the G format specifier is supported as per the MSDN documentation Language Support | Burst | 1.7.4

Is this something I’m doing wrong, or expected behavior?

Hello jaydenm,

What version of Burst are you running?
I tried your code myself, and with Burst 1.7.3 I get the expected result.

Try running it with Burst compilation disabled. If it still prints incorrectly, it can’t be because of Burst (I would assume).