I seem to be facing an error whereby I can’t disable my GUI Layer.
I’m disabling the guilayer then taking a screenshot and then re-enabling it - but this doesn’t seem to be working.
private GUILayer guiLayer;
// Use this for initialization
void Start () {
guiLayer = GameObject.Find("MainCamera").GetComponent<GUILayer>();
}
public void CaptureButton(){
if(GUI.Button(new Rect(Screen.width-225, (Screen.height-100)+25, 200, 50), "Capture")){
guiLayer.enabled = false;
StartCoroutine(CaptureScreenshot());
}
}
IEnumerator CaptureScreenshot(){
yield return new WaitForEndOfFrame();
//TAKE SCREENSHOT CODE
yield return new WaitForEndOfFrame();
guiLayer.enabled = true;
}
I’ve tried removing the re-enable line at the end of the CaptureScreenshot line but the GUI stays throughout. I’ve even tried adding the guiLayer.enabled = false line to the Start() function with the hope that this’ll illustrate whether or not the line itself is working but it’s not.
Can anyone help?