Godot Version
4.3
Question
I want to export a float property to the inspector. However, when I used @export_range annotation and set step to 1, it will be shown as an int type in the inspector. And whatever I changed the value, it always be an int!
Show us the complete export export line, please.
1 Like
The export line just like this:
@export_range(-10.5, 10.5, 1.0) var value: float = 3.14
As long as the step is set to 1, no matter what the value is set, it always be shown an int value in the inspector.
You told Godot to snap the selected value to multiples of 1.0, which can be converted to an integer in the inspector. This looks like a bug in the inspector, which should, in my opinion, always use the declared type.
First, as explained by @soapspangledgames the problem here is you’re snapping the value to multiplies of 1 so you’ll never be able to set the decimal values.
Second, you variable is not turning into a int, is just the editor that don’t show the decimal numbers as they are unecessary (all zeros), you can confirm that with a print(typeof(value))
that will print 3: