Hello, I needed to use PlayerPrefs.SetBool() and then I realised there’s no such thing, so I’ve found a work around, which was this method http://wiki.unity3d.com/index.php?title=BoolPrefs I made a new script, copied and pasted the whole code given in the link and now I get this error
“Assets/Scripts/interaction.cs(18,37): error CS0176: Static member `PlayerPrefsX.SetBool(string, bool)’ cannot be accessed with an instance reference, qualify it with a type name instead”
I tried to google for the solution but none of the posts appeared to be relevant to my issue, I’m pretty sure it’s just like a one letter or word in the code that is causing this problem but I can’t find it
using UnityEngine;
using System.Collections;
public class PlayerPrefsX : MonoBehaviour {
public static void SetBool(string name, bool booleanValue)
{
PlayerPrefs.SetInt(name, booleanValue ? 1 : 0);
}
public static bool GetBool(string name)
{
return PlayerPrefs.GetInt(name) == 1 ? true : false;
}
public static bool GetBool(string name, bool defaultValue)
{
if(PlayerPrefs.HasKey(name)) //Error here
{
return GetBool(name);
}
return defaultValue;
}
}
Thanks!