Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Check if running on Steam Deck

Discussion in 'General Discussion' started by kloot, Apr 13, 2022.

  1. kloot

    kloot

    Joined:
    Mar 14, 2018
    Posts:
    43
    Hi there,
    I don't have a Steam Deck dev-kit, but my game does run on that platform. However, I can't seem to find a way to (in runtime) distinguish if the game is currently running on Linux or the Steam Deck. Usually one would check Application.platform, but even in 2021.3, there is no enum value for the SteamDeck...

    Any ideas?

    Thanks!
     
  2. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    12,386
    Logically speaking steam deck is Linux.

    A good idea would be to contact valve support and ask them this question.

    You could also try poking /proc at runtime to determine CPU type, as it is supposed to be a fairly custom one.
     
  3. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    1,042
  4. kloot

    kloot

    Joined:
    Mar 14, 2018
    Posts:
    43
    Thank you, no info about this question there, tho.
    I also asked on the Steamworks forum, will post here if I get an answer.
     
  5. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    1,042
    Ah, I hoped something would pop up there on the topic. I haven't gone through the material yet.

    My deck is on its way, but it's retail. I hear all devkit related content is publicly available so hopefully it won't lack much on dev side of things.
     
  6. kloot

    kloot

    Joined:
    Mar 14, 2018
    Posts:
    43
    The folks at Steam answered
    Al long as you have a reference to Steamworks, you can check Steamworks.SteamUtils.IsSteamRunningOnSteamDeck();
     
  7. Jinja

    Jinja

    Joined:
    Nov 28, 2012
    Posts:
    9
    You could also place an option in your user options section for whatever reason you need to know if it's on Steam Deck. I'm guessing because you want to alter your UI for a small screen. You could add a "Small Screen UI" checkbox in your graphics options which would be useful for anyone who is running your software on a small screen, not just Steam Deck users. Autodetecting Steamdeck can set the default value.
     
    Linkupdated likes this.
  8. sarahnorthway

    sarahnorthway

    Joined:
    Jul 16, 2015
    Posts:
    69
    I don't know about Windows games running on Steam Deck, but my Linux-native build reports this metadata:

    Code (CSharp):
    1. SystemInfo.DeviceModel: PC
    2. SystemInfo.DeviceType: Desktop
    3. Application.platform: LinuxPlayer
    4. SystemInfo.OperatingSystem: Linux 5.13 SteamOS 3.3.1 64bit
    5. SystemInfo.OperatingSystemFamily: Linux
    6. Input.GetJoystickNames(): Steam Virtual Gamepad
    So I'm using SystemInfo.operatingSystem.Contains("SteamOS") if I need to know the device before Steamworks.NET initializes.

    After that I use Steamworks.SteamUtils.IsSteamRunningOnSteamDeck();
     
  9. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,212
    Was going to look into this as I've just received my steam deck
     
  10. astracat111

    astracat111

    Joined:
    Sep 21, 2016
    Posts:
    699
    Official Steam documentation is here:

    https://partner.steamgames.com/doc/api/ISteamUtils

    According to Steam's readme.txt that comes with the Steamworks API:

    Code (CSharp):
    1. v1.52 14th September 2021
    2. ISteamUtils
    3. * Added IsSteamRunningOnSteamDeck - Can be used to optimize the experience of the game on Steam Deck, such as scaling the UI appropriately, applying performance related settings, etc.
    You can download the Steamworks API here:
    https://partner.steamgames.com/doc/gettingstarted

    Luckily, the Steamworks.NET thing is version 1.55 of Steam, so gonna try that out and report back here on how it goes:
    https://github.com/rlabrecque/Steamworks.NET/releases

    Right now my build for Linux is working perfectly on the Steam Deck, flawlessly even, all that's left is to add the inputs using the Steam API. ¯\_(ツ)_/¯
     
    Last edited: Dec 29, 2022