Search Unity

onClick button working in Unity editor but NOT iOS device

Discussion in 'Getting Started' started by tweinreb, Jul 14, 2020.

  1. tweinreb

    tweinreb

    Joined:
    Jun 22, 2020
    Posts:
    1
    Hello!
    I have a button with an attached script.
    I've added a simple handler function which is supposed to run when the button is clicked.

    Code (CSharp):
    1.   public void FriendButtonHandler()
    2.     {
    3.         Debug.Log("Hello from friend!");
    4.     }
    In the Unity editor, everything works as expected, and the console shows the logged message.
    However, when I run the Unity project on an iOS device, the function never gets called.

    iOS does seem to register the clicks somewhat, since the button does change colors correctly through the sprite swap. Yet, the onClick handler script is never called by iOS.

    I have the EventSystem and Graphic Raycaster in the scene, and I have not changed any default settings.
     
  2. shuaibimran

    shuaibimran

    Joined:
    Sep 10, 2014
    Posts:
    7
    I'm facing the same issue, have you found any resolution?
     
  3. VinceGunday

    VinceGunday

    Joined:
    Mar 9, 2021
    Posts:
    5
    Same issue here. Do you have any other solutions to this? Im using Iphone12
     
  4. VinceGunday

    VinceGunday

    Joined:
    Mar 9, 2021
    Posts:
    5
    I have found out the problem on my side. In IOS native I have added addView which causes to cover the Unity view and UI buttons not triggering.