still trying to just get the current state of the buttom
using UnityEngine;
using System.Collections;
public class optionsToMain : MonoBehaviour {
void OnToggleChanged()
{
PlayerPrefs.SetInt ("lyd", UIToggle.current.value);
Debug.Log ("Sound toggle");
}
}
Didnt work either.
getting "The best overloaded method match for 'UnityEngine.PlayerPefs.SetInt(string, int)' has invalid arguments.
Well i think the toggle is returning a bool not 1 or 0.. so it must be true or false ..
gonna try to "CONVERT" the bool to int then, because you can't save a bool..

Edit, now tried this,, no errors, but also no functionality..
using UnityEngine;
using System.Collections;
public class optionsToMain : MonoBehaviour {
public bool tempValue;
//public int soundStatus;
void OnToggleChanged()
{
tempValue = UIToggle.current.value;
if(tempValue){
PlayerPrefs.SetInt ("lyd", 1);
} else {
PlayerPrefs.SetInt ("lyd", 0);
}
// soundStatus = UIToggle.GetActiveToggle(tempSound, 1);
// PlayerPrefs.SetInt (gameSound, soundStatus);
Debug.Log ("Sound toggle");
}
}
The script is ofcourse attached to the actual toggle button which has the UIToggle script on it.