Unity Button OnClick working on PC but not working on Android

Viewed 38

the idea of the function is that it changes one canvas for another. The problem is that it works perfectly on PC, but on android the button receives the click (because it changes colour) but it doesn't execute the function. Any help? Thanks :)

Button's inspector tab Button on Hierarchy

public void SwapToCanvas(int n)
{
    if (controller != null)
    {
        Destroy(controller.LastGuia.gameObject);
    } else
    {
        controller = GameObject.Find("GuiaController").GetComponent<GuiaController>();
        Destroy(controller.LastGuia.gameObject);
    }
    
    controller.GetComponent<GuiaController>().LastGuia = Instantiate(SwapTo[n]);
    Destroy(this.gameObject);
}
0 Answers
Related