Hi all, I have a problem.
I want to save a function but I don’t know how to do this. I have made some speakers in diffrent scenes, and they set the music on and off when you click it. But when you go to scene 1 and you set the music on and than go to scene 2, you can’t set the music off because its standard stand off. So I thought maybe I can save it with playerprefs. I have seen alot of video’s about it but not about saving things like this. I’m not a pro in unity I use it now for 5 months and C# too. So I hope somebody can help me with this problem.
The script for the speaker to set the music on:
public GameObject henk;
public void ChangeToScene (int sceneToChangeTo) {
henk.SetActive(false);
}
The script for the speaker to set the music off:
public GameObject henk2;
public void ChangeToScene (int sceneToChangeTo) {
henk2.SetActive(true);
}
The script is connected via an OnClick.
Thanks!