Question by
riestrella95 · May 04, 2020 at 10:02 AM ·
androidcanvas
What am I missing? I can't set my canvas active after pressing back button on android
Hi everyone, so my problem is that I'm activating a canvas when pressing a button in my script with the simplest function:
public void myFunction(){
myVarName.SetActive(true);
}
and I deactivate it when I press the back button on android:
private void Start()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
gameObject.SetActive(false);
}
}
it works fine, but when I try to enter again to that canvas by tapping on my button, it won't happen again. What am I missing? Is there another way to do what I want?
When I use the inspector to use a "back" button, it works correctly by setting game object bool to false. I'm confused.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612233147im_/https://answers.unity.com/themes/thub/images/avi.jpg)