Controlling Resolution on ATV4 vs ATV4K

Hi!

I have a Platform Manager script I’ve created that can detect which platform (such as iOS vs tvOS) and sets the resolution accordingly to maximize performance.

Just like how we can get platform, is there a way to get which device generation between Apple TV 4 and Apple TV 4K so I can set a boolean and then do an if/then to route & set resolution accordingly? How can this be done?

For performance reasons, I need to set a lower resolution on ATV4 but want a higher res for ATV4K.

Thanks for your insight!

Not sure if it actually works.

If you have both devices, you could also see what things like SystemInfo.graphicsDeviceVendor return in each device and then check for that in your code.

1 Like

Thanks! I’ll look into this and give it a try!

It seems Unity’s device check doesn’t actually work.

using UnityEngine;

public class AstrogunPlatformManager : MonoBehaviour {

    // Apple TV Generation
    private     bool                atv4        =   false;
    private     bool                atv4k       =   false;

    // init
    void Start ()
    {

#if UNITY_TVOS

        Debug.Log("Astrogun Platform Manager: Settting for tvOS");

        if (UnityEngine.tvOS.Device.generation == UnityEngine.tvOS.DeviceGeneration.AppleTV1Gen)
        {
            Debug.Log("Astrogun Platform Manager: Current Device: Apple TV 4");
            atv4 = true;
            atv4k = false;
        }
        else if(UnityEngine.tvOS.Device.generation == UnityEngine.tvOS.DeviceGeneration.AppleTV1Gen)
        {
            Debug.Log("Astrogun Platform Manager: Current Device: Apple TV 4K");
            atv4 = false;
            atv4k = true;
        }

        Debug.Log("Astrogun Platform Manager: Final Device Check: ATV4:" + atv4);
        Debug.Log("Astrogun Platform Manager: Final Device Check: ATV4K:" + atv4k);
}

Both atv4 & atv4k return false.

It is worth noting that Unity erroneously calls the ATV4 ‘Apple TV 1’ and the ATV4K ‘Apple TV 2’. Technically the ATV4K is the Apple TV 5. But whatever. They’re obviously resetting the count from the first Apple TV device to have tvOS (Apple TV 4), but Unity would be the only ones to do that.

Also curiously, in line code, I couldn’t use the Device Generation tags for anything unless I added ‘UnityEngine’ first even though I’m already designating ‘using UnityEngine;’ at the top.

Anyone have any ideas why this wouldn’t work?

Or am I missing something? I hope I’m just missing something…

~

Using ‘SystemInfo.graphicsDeviceVendor’, we get ‘Apple A8 GPU’ on ATV4 and ‘Apple A10X GPU’ on ATV4K. At this point I’m guessing this technique will work instead.

Update: Yep, using ‘SystemInfo.graphicsDeviceVendor’ worked instead. Thanks @AcidArrow !

1 Like

One issue I noticed in your code is the if and else if statements both refer to AppleTV1Gen.

Have you tried Debug.Log(UnityEngine.tvOS.Device.generation); to see what it returns?

1 Like

Good catch-- I’ll try it again and try the debug log too