Hello there, having an issue capping the rendering resolution of the secondary display.
We built an iOS game, and we need to cap the resolution otherwise it simply won’t run off the iPhone when connected to a secondary display.
When we connect the phone to a 1080P TV it works fine. But when connected to the 4K TV/Display it forces the phone to render at the higher resolution. How can we cap the resolution and FPS that the game runs at for iOS connected to an external display?
We are using an iPhone 15+ connected through HDMI through the USB C port to a TV or display.
It’s very easy to do this iOS native code, but seemingly not possible to do in Unity?
Below is how it’s done in iOS native code.
import SwiftUI
import UIKit
class ExternalSceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
if session.role == .windowExternalDisplayNonInteractive {
let screen = windowScene.screen
// Set the resolution to 1920x1080
if let targetMode = screen.availableModes.first(where: { $0.size == CGSize(width: 1920, height: 1080) }) {
screen.currentMode = targetMode
}
// Create and set up the window for this scene
let window = UIWindow(windowScene: windowScene)
let screenSize = screen.bounds.size // Get the actual screen size
window.rootViewController = UIHostingController(rootView: ExternalRootView(model: (UIApplication.shared.delegate as! AppDelegate).model, screenSize: screenSize))
window.makeKeyAndVisible()
self.window = window
}
}
}
Any idea how we can do this in Unity without having to create a custom iOS native app with Unity running inside? This has blocked us for weeks, hopefully there is a solution!
Thanks