Search Unity

Resolved Some buttons take more clicks to respond

Discussion in 'Input System' started by Rickard87, Apr 29, 2022.

  1. Rickard87

    Rickard87

    Joined:
    Oct 12, 2021
    Posts:
    39
    I have this problem where the buttons don't respond until a few clicks inside the UnityEditor. I have not tried building this project to my phone yet. I have encountered this problem before where the buttons kinda jam a bit.

    So the bottom 4 buttons load the same scene, and they work in 1 click.

    The top 2 buttons opens UI Images (gameObject.setactive(true)).
    The top button (Reset) takes 3 clicks to open the UI Image.
    The second button (Rules) takes 2 clicks to open the UI Image.

    Can anyone help me figure this out?
    I have tried disabling everything besides the canvas they are all directly children of.


    upload_2022-4-29_19-47-54.png
     
  2. Rickard87

    Rickard87

    Joined:
    Oct 12, 2021
    Posts:
    39
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class ResetScript : MonoBehaviour
    6. {
    7.     public GameObject ResetPromptUI;
    8.  
    9.     private void Start()
    10.     {
    11.         ResetPromptUI.SetActive(false);
    12.     }
    13.  
    14.     public void ResetPrompt()
    15.     {
    16.         Debug.Log("WHY DOES IT TAKE 3 CLICKS");
    17.         ResetPromptUI.SetActive(true);
    18.     }
    19.  
    20.     public void ResetAllPlayerprefs()
    21.     {
    22.         PlayerPrefs.DeleteAll();
    23.         ResetPromptUI.SetActive(false);
    24.     }
    25.  
    26.     public void CloseResetPromptUI()
    27.     {
    28.         ResetPromptUI.SetActive(false);
    29.     }
    30.  
    31. }
    It always takes 3 clicks for the UI to open. The text "WHY DOES IT TAKE 3 CLICKS" debugs fine on all 3 clicks