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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

OnApplicationPause not being called in iOS build

Discussion in 'Scripting' started by d34thst4lker, Feb 8, 2017.

  1. d34thst4lker

    d34thst4lker

    Joined:
    Aug 4, 2013
    Posts:
    124
    I am currently using Unity 5.5.1p2 and I have looked in dozens of places and cannot seem to figure out why this is happening.
    I am trying to get OnApplicationPause to work (in two scripts) but when I run on my iOS Devices I do not get any logs from the function.

    Is this broken?? I need to have this function working.

    Thanks in advanced

    EDIT : Apparently, it was not working because I had 'Behaviour in Background' set to Custom instead of Suspend...
    How can I get this to work if 'Behaviour in Background' is set to Custom??
     
    Last edited: Feb 8, 2017
    CasualT_Bossfight likes this.
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,798
  3. d34thst4lker

    d34thst4lker

    Joined:
    Aug 4, 2013
    Posts:
    124
    Yes, That does work. However, for my needs I need to have OnApplicationPause rather than OnApplicationFocus
     
  4. CasualT_Bossfight

    CasualT_Bossfight

    Joined:
    Oct 26, 2016
    Posts:
    8
    Thanks d34thst4lker, I had the same problem. I wasn't aware that setting that to Custom would entirely prevent your app from receiving OnApplicationPause events.
     
  5. waldgeist

    waldgeist

    Joined:
    May 6, 2017
    Posts:
    365
    Facing the same problem.

    Did you ever figure out how this works if 'Behaviour in Background' is set to Custom?
     
  6. doctorpangloss

    doctorpangloss

    Joined:
    Feb 20, 2013
    Posts:
    267
    Hey! I recognize you @waldgeist from the Meteor forums.

    I think this has to do with some more checkboxes in the player settings, XCode and your entitlements.