Decimals in Javascript....(and a bonus question!)

…I’m trying to save the gravity for the PlayerPrefs. saving as a float with a value of -9.81 I get “invalid DWORD” in regedit and the value doe not read properly (as expected at that point). Anyone with an idea on storing decimal values in the PlayPrefs?

Bonus question:
Works:
static var audioVolume : float;
audioVolume = parseFloat(PlayerPrefs.GetString(“Volume”));

Does not:
static var audioVolume : float = parseFloat(PlayerPrefs.GetString(“Volume”));

reason?

Static vars get their value when the run-time loads (or something along those lines) - so I’m assuming either parsefloat or playerprefs isn’t available at that time - hence you have to set the value separately.

Herm…would make sense. Static vars get a default value (or null), then built in functions load and static vars reset to those values…

You are correct, ‘parseX’ (float/String/etc) is not accessible until after application run-time loads. TY for such a quick answer.

*Bump for the decimal question…