- Home /
Question by
Philippe Vincenti · Apr 02, 2015 at 10:26 AM ·
unity5webglplayerprefs
Playerprefs.setInt generates errors in webGL
I've been using playerprefs quite a bit in a webGL project and every time I set an int, I get an error message in my browser console saying "Uncaught TypeError : Cannot read property 'length' of null". This happens every time I use PlayerPrefs.SetInt(), no matter what the context is. The weird part is that my playerPrefs are saved, I can use them as much as I want without a problem, but I just get these random error messages. Here's an example of a function that causes the error :
public void ChangeCustomSetting(string settingName, int SettingValue)
{
Debug.Log("ChangeCustomSettings");
isCustom = true;
PlayerPrefs.SetInt(settingName, SettingValue + 1);
}
Comment