I've set texture2 to be the new "texture" in the PlayerPrefs like this:
PlayerPrefs.SetString("texture","texture2")
But how can I turn the following script's string:
PlayerPrefs.GetString("texture")
into:
mainTexture = PlayerPrefs.GetString("texture")
So it will change "texture2" into texture:
mainTexture = texture2
I'm not using variables because I want the chosen texture to be saved(and loaded). Thanks in advance! Any help is appreciated! :)
I've figured it out:
I changed PlayerPrefs to:
PlayerPrefs.SetString("tex","texture2")
And made one more for texture1.
Then, I made a function called MuteCheck, and this is what I put inside:
public void MuteCheck()
{
texture = PlayerPrefs.GetString ("tex");
if (texture == "texture2")
{
textureBool = false;
}
else if (texture == "texture1")
{
textureBool = true;
}
}
After that I mad a Update function like this:
void Update()
{
if(textureBool == false)
{
AudioListener.pause = true;
mainTexture = Texture2;
}
else if(textureBool == true)
{
AudioListener.pause = false;
mainTexture = Texture1;
}
}
And now it works perfectly! :)