I’m continuing to have a play with custom editors for scriptableobjects, I’ve added a float value to the class/SO and added:
newWeaponDamage = EditorGUILayout.FloatField(new GUIContent("Damage: "), newWeaponDamage);
I was expecting the FloatField to not accept letters when it was used… except when I try every letter in order on the keyboard (top row → bottom row, left ->right) it will accept the following letters:
when you click off the field the value changes to 0.
I can’t think of any reason for these specific letters to be allowed in a FloatField… any ideas?
sounds like a glitch not sure. A unity dev would be best to say.
edit: well f has to be i think because a float has to end in a f not sure if that is the same in a FloatField
Floats can actually be a little more than just numbers. You can enter -Infinity for example.
You will also be able to type in values like 5e+09 which is what you would see for really large values.
Certain operations will result in a Not a number or NaN float, this will also show in the inspector, although you don’t seem to be able to set this directly yourself.
With Unity 5.1 you can enter simple expressions directly into the fields, if you enter 0/0 you will get NaN.
Some more information can be found here:
Another edit:
From the letters you found etyiafn, Infinity can be written, e as in 5e+09 aswell, n & a as in NaN.
1 Like
you have values like:
NaN
Infinity
scientific notation (7.14+e6)
1 Like