Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

button.onclick trigger twice on ios device

Discussion in 'iOS and tvOS' started by 19198926, Apr 26, 2016.

  1. 19198926

    19198926

    Joined:
    Dec 30, 2014
    Posts:
    3
    Forgive my poor english……
    I have found a strange problem, as the title said up.
    The problem happened when the "applicationWillResignActive" method was triggered in "onclick" callback, example:

    Code (CSharp):
    1.  
    2. public void OnButtonClick()
    3. {
    4.     Debug.Log("Button Click!");
    5. }
    6.  
    now it is fine, when i click the button, the log print once. then i changed it to

    Code (CSharp):
    1.  
    2. public void OnButtonClick()
    3. {
    4.     Debug.Log("Button Click!");
    5.     Application.OpenURL("[URL]http://www.google.com[/URL]");
    6. }
    7.  
    the new code is just to let the system method "applicationWillResignActive" triggered. But now, the output log will print twice, looks like:


    Button Click!
    ……(the stack info)
    -> applicationWillResignActive()
    ButtonClick!
    ……(the stack info)
    -> applicationDidEnterBackground()



    i have tried some different methods to trigger "applicationWillResignActive", and they also have the same problem.

    Can someone please help me?
    my unity version is 4.6.9f1.
     
    Last edited: Apr 26, 2016
  2. Joker921

    Joker921

    Joined:
    Mar 27, 2015
    Posts:
    4
    I met it too. Can somebody help me?
     
  3. povilas

    povilas

    Unity Technologies

    Joined:
    Jan 28, 2014
    Posts:
    427
    Hi, Unity 4.x is no longer supported. Could you please check whether this happens on supported version of Unity, like 5.3.x?
     
  4. 19198926

    19198926

    Joined:
    Dec 30, 2014
    Posts:
    3
    hi povilas:
    thanks for your reply. as your suggest, i have tried the same code on version 5.3.4p6, and the problem disappeared. so it may be a bug on 4.x.
     
  5. 19198926

    19198926

    Joined:
    Dec 30, 2014
    Posts:
    3
    i have tried the same code on version 5.3.4p6, and the problem disappeared. so it may be a bug on 4.x.