Hi im using the playerprefsx from unity wiki and i cant seem to get it to work. i am attempting to save a bool so that when the player gets to the next level the audio settings save but i cant seem to get it to work
using UnityEngine;
using System.Collections;
public class AudioOnOff : MonoBehaviour
{
bool AudioOff;
public Texture Off;
public Texture On;
void Start()
{
PlayerPrefsX.GetBool ("AudioSwitch");
}
void OnMouseOver()
{
if(Input.GetKeyDown(KeyCode.Mouse0))
{
AudioOff = !AudioOff;
}
}
void Update()
{
if (AudioOff == true)
{
PlayerPrefsX.SetBool ("AudioSwitch",AudioOff);
}
if (AudioOff == false)
{
PlayerPrefsX.SetBool ("AudioSwitch",AudioOff) ;
}
if (PlayerPrefsX.GetBool ("AudioSwitch") == true)
{
renderer.material.mainTexture = Off;
audio.volume = 0F;
}
if (PlayerPrefsX.GetBool ("AudioSwitch") == false)
{
renderer.material.mainTexture = On;
audio.volume = 1F;
}
}
}