I'm working on making my options menu work with PlayerPrefs so that all the options are saved when the player reloads the game. I totally understand why there would be something wrong with my code here I'm just not sure how to fix it. Any help is much appreciated!
public class GameVar : MonoBehaviour
{
public static float mouseSensitivity = 1000f;
public static bool mouseInvert = false;
public static bool playerDead = false;
public Slider sensSlider;
public GameObject mouseInvToggle;
void Start ()
{
sensSlider.value = PlayerPrefs.GetFloat("mSensitivity");
mouseInvToggle.GetComponent().isOn = PlayerPrefs.GetInt("mInvert") == 0 ? false : true;
}
public void ToggleInvert()
{
if (PlayerPrefs.GetInt("mInvert") == 1) PlayerPrefs.SetInt("mInvert") = 0;
else PlayerPrefs.SetInt("mInvert") = 1;
mouseInvert = PlayerPrefs.SetInt("mInvert");
mouseInvToggle.GetComponent().isOn = PlayerPrefs.GetInt("mInvert") == 0 ? false : true;
}
public void ChangeMouseSens()
{
PlayerPrefs.SetFloat("mSensitivity") = sensSlider.value;
mouseSensitivity = PlayerPrefs.GetFloat("mSensitivity");
}
}
I get 4 errors that say this:
----------
error CS7036: There is no argument given that corresponds to the required formal parameter 'value' of 'PlayerPrefs.SetInt(string, int)'
↧