Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A sub-classed UnityAppController that allows a tvOS application to be manually suspended, to circumvent Unity issue #1134856. To use, place both files in a Plugin/tvOS folder in your Unity project and call UnityEngine.tvOS.Application.ExitToHomeScreen to suspend the application.
namespace UnityEngine
namespace tvOS
public class Application
extern static public void ExitToHomeScreen();
#import "UnityAppController.h"
@interface SuspendableAppController : UnityAppController
-(void) exitToHomeScreen;
static SuspendableAppController* delegateObject;
@implementation SuspendableAppController
-(void) startUnity: (UIApplication*) application {
[super startUnity: application];
delegateObject = self;
-(void) exitToHomeScreen {
UIApplication *app = [UIApplication sharedApplication];
[app performSelector:@selector(suspend)];
extern "C" {
void ExitToHomeScreen() {
[delegateObject exitToHomeScreen];
IMPL_APP_CONTROLLER_SUBCLASS( SuspendableAppController )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment