Search Unity

Switching app to background locks FPS - fixable with unityView.alpha set to 0.99f

Discussion in 'Scripting' started by GeorgeCH, Nov 30, 2018.

  1. GeorgeCH

    GeorgeCH

    Joined:
    Oct 5, 2016
    Posts:
    222
    Since the last few releases of Unity (I'm running 2018.2), I noticed that there's a bug where if you play an ad, switch the volume, or basically do anything that would cause the main game screen to be overlaid with another screen (an ad, the volume status icon, etc), it can use the application's FPS to lock to 40.

    Profiling in XCode confirms that it is not due to hardware limitations, as the application doesn't come close to taxing my device's CPU, rendering or graphics.

    The only workaround I found is to manually edit the UnityAppController.mm file as to include _unityView.alpha = 0.99f in the ApplicationDidBecomeInactive method - but it has to be done every time I assemble a new build and seems like something Unity should be handling itself?
     
  2. I think it worth to submit a bug report, they probably can track down what's happening.
     
    Shorely likes this.
  3. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    Could you please submit a bug report if you think there is an issue? The mentioned thread is 3 years old.
     
  4. FIFTYTWO

    FIFTYTWO

    Joined:
    Oct 21, 2014
    Posts:
    49
    The issue is still presented in Unity 2020.2 and the fix _unityView.alpha = 0.99f is still a valid workaround but I can't find any explanation why it is working. By the way, tvOS has the same issue as iOS.