Hi All Unities,
What could I do to disable a specific button in paused event? or How could I reactivate an object? I been trying different methods but please help me if you could thanks.
Regards,
function PauseGame() {
var newTarget = GameObject.FindWithTag("Player").transform;
var newTarget2 = GameObject.FindWithTag("Patriot").transform;
newTarget.active = false;
newTarget2.active = false;
ButtonNoice();
savedTimeScale = Time.timeScale;
Time.timeScale = 0;
AudioListener.pause = true;
if (pauseFilter) pauseFilter.enabled = false;
currentPage = Page.Main;
}
function UnPauseGame() {
var newTarget = GameObject.Find("Ship");
var newTarget2 = GameObject.Find("Patriot");
ButtonNoice();
Time.timeScale = savedTimeScale;
AudioListener.pause = false;
if (pauseFilter) pauseFilter.enabled = true;
currentPage = Page.None;
if (IsBeginning() && start != null) {
start.active = true;
newTarget.SetActiveRecursively(true);
newTarget2.SetActiveRecursively(true);
}
}
Err ya, the PauseGame() works but the UnpauseGame() aren't... but what are the priority value should it be? This script from the unify wiki.
– BSVALVEI don't know what "what are the priority value should it be?" means.
– sneftelI just don't understand "based on their prior values rather than trying to find them" means so I wrote that hope this understandable for you.
– BSVALVEIn other words, in UnPause you won't need to call Find(), because you will already have found the objects in PauseGame and kept them in the variables. Of course, in order for that to work, newTarget and newTarget2 need to not be local variables, so that their value stays around after PauseGame() is over.
– sneftel