I have a menu scene where there is three button options. Once player click one button, it bring them to a description scene. when player click next on the description scene, they will go back to the menu scene and I want the clicked button to be not visible. After all three button are clicked, it automatically brings them to the last scene. But I cant even make the first button clicked not visible.
One more concern is that I want the app to restart all over again after 2 minutes of inactivity. I am worried that the disabled buttons will not reload. How do I avoid that?
Please explain in details as I am new to coding and unity. Appreciate your help!!
Use playerprefs to save data, so, when you press button#1, save value into PlayerPrefs like,
PlayerPrefs.SetInt("button1",1);
and then when entering the scene with that button, check if that value is 1 and disable that button
int buttonState = PlayerPrefs.GetInt("button1",0);
You can also search for
DontDestroyOnLoad (to keep your gameobject/script alive between scenes)
or just search for examples about: passing data between scenes
If i use DontDestroyOnLoad, will the disabled buttons work again? I want to reload the entire project after 2 minutes of inactivity including the disabled button so that it works again after the reload. Its basically like a replay but starts automatically after 2minutes of not doing anything.
You could use a script with booleans attached to a game object with a dontdestroyonload which holds what button may be on or off. and let the buttons check that script if they are interactable on Awake.