Search Unity

2019.1.0f2 - Impossible to publish with "UnityEngine.tvOS.Remote.allowExitToHome" bug

Discussion in 'Editor & General Support' started by azconapithecus, May 2, 2019.

  1. azconapithecus

    azconapithecus

    Joined:
    Dec 23, 2016
    Posts:
    2
    In Unity 2019.1.0f2, Setting UnityEngine.tvOS.Remote.allowExitToHome to "true" no longer functions correctly making it impossible to return to the AppleTV home screen when pressing the "Menu" button on the device's Siri Remote. This occurs on both AppleTV (2015) and AppleTV 4K devices. Without this functionality enabled in an app's top menu, it will fail Apple approval.

    Repro steps:
    • Create a new project in Unity 2019.1.0f2
    • Create the following script and attach it to a game object in the scene:
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class ExitToHomeEnabler : MonoBehaviour
    4. {
    5.     void Start()
    6.     {
    7.         UnityEngine.tvOS.Remote.allowExitToHome = true;
    8.     }
    9. }
    • Save, build, and run the project on a tvOS device
    • Press the "Menu" button on the device's Siri Remote or any other paired AppleTV controller
    Result:
    • App will not exit to the home screen as expected.
    • Note that while running on tvOS, "allowExitToHome" will return "true" when queried.
    I have been unable to locate an alternative solution to force suspension of a tvOS app making this appear to be a fairly critical bug in Unity. Furthermore, it seems Unity's page "Building Games for Apple TV" (https://docs.unity3d.com/Manual/tvOS.html) is woefully out of date in numerous places and contains obsolete code.

    Any assistance on this matter would be greatly appreciated!
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
  3. azconapithecus

    azconapithecus

    Joined:
    Dec 23, 2016
    Posts:
    2
    Thank you! I did not find a means to post bugs on the "Issue Tracker" tab above and, as this forum is linked together with that page, it appeared posting here must be the place to do so. The bug has now been reported via your link and hopefully a fix for this will appear in the soonest release possible!
     
  4. jring

    jring

    Joined:
    Dec 2, 2015
    Posts:
    7
    +1 for this getting fixed (having the same problem using 2018.3). I could have sworn I saw this issue already in the bug tracker a month ago, but can't find any trace of it now. It's a pretty critical issue for a lot of developers so I hope they jump on it soon.
     
  5. Zaikman

    Zaikman

    Joined:
    Aug 2, 2011
    Posts:
    17
    Do you have the issue ID for the bug you reported? We're having the same issue and it would be great to track/reference this.
     
  6. renanse

    renanse

    Joined:
    Apr 12, 2013
    Posts:
    21
  7. Zaikman

    Zaikman

    Joined:
    Aug 2, 2011
    Posts:
    17
  8. Dmitry-Pyalov

    Dmitry-Pyalov

    Joined:
    Dec 13, 2011
    Posts:
    125
    It seems like I've found a legit workaround. But I'm no professional iOS developer, so I don't know if there are any side effects.

    I've just added these 2 files to XCode project :)

    UnityView+tvOSFix.h
    Code (CSharp):
    1. #pragma once
    2.  
    3. @interface UnityView (tvOSFix)
    4.  
    5. - (void)pressesBegan:(NSSet<UIPress*>*)presses withEvent:(UIPressesEvent*)event;
    6. - (void)pressesEnded:(NSSet<UIPress*>*)presses withEvent:(UIPressesEvent*)event;
    7.  
    8. @end
    9.  
    UnityView+tvOSFix.m
    Code (CSharp):
    1. #if PLATFORM_TVOS
    2.  
    3. #import "UnityView.h"
    4.  
    5. @implementation UnityView (tvOSFix)
    6.  
    7. - (void)pressesBegan:(NSSet<UIPress*>*)presses withEvent:(UIPressesEvent*)event
    8. {
    9.     [super pressesBegan:presses withEvent:event];
    10. }
    11.  
    12. - (void)pressesEnded:(NSSet<UIPress*>*)presses withEvent:(UIPressesEvent*)event
    13. {
    14.     [super pressesEnded:presses withEvent:event];
    15. }
    16.  
    17. @end
    18.  
    19.  
    20. #endif // PLATFORM_TVOS
    21.  
    And it suddenly started working. For me it's a kind of magic because all it does is call parent method.