I have part of my interface on a slide in animated panel on a canvas that lights up a indicator light (U.I. button)
Now if I set it for open the indicator light switches switches to active and the other indicator switches to un active via a manager C# script.
Now how do I retain that data across scene changes?
I tried putting the Don’t destroy on load on my manager script but weird things happen. For one it does not carry the data across scene changes, secondly if I remove the Don’t destroy on load stuff to put my script back to normal then my indicators don’t respond to the make active and not active portion of the IEnumerator part of the script.
How can I fix this?
Here is a portion of my script that has the Autodoors set active and un active functions.
NOTE: I placed some images in the comments below of my inspector and the U.I. Panel that has the indicator lights on it that I am wanting to remember their settings when I leave that main scene and go to other scene and then return to the main scene.
//Auto Door Left
public void GoAutoDoorLeft(){
StartCoroutine(AutoDoorL());
//Star Indicator Light On Coroutine
StartCoroutine(AutoDoorLindicatorOn());
}
//Indicator L On Initiator
IEnumerator AutoDoorLindicatorOn(){
yield return new WaitForSeconds (2.0f); // wait time
//initiate Indicator light On
AutoDoorOpenLightOnLeft.SetActive(!AutoDoorOpenLightOnLeft.active);
AutoDoorCloseLightOnLeft.SetActive(!AutoDoorCloseLightOnLeft.active);
GetComponent<AudioSource>().PlayOneShot(DTMFtone01);
}
IEnumerator AutoDoorL(){
yield return new WaitForSeconds (0.5f); // wait time
anim.enabled = true;
//play the Slidein animation
anim.Play("AutoDoorsIndicatorsSlideInAni");
GetComponent<AudioSource>().PlayOneShot(AutoDoorSlideInFX);
}
//Auto Door Screen Slide Out
public void AutoDoorSlideOut(){
StartCoroutine(AutoDoorOut());
}
IEnumerator AutoDoorOut(){
yield return new WaitForSeconds (3.0f); // wait time
anim.enabled = true;
//play the SlideOut animation
GetComponent<AudioSource>().PlayOneShot(AutoDoorSlideOutFX);
anim.Play("AutoDoorIndicatorsClosed");
}